<template>
    <div style="height: 100%; width: 100%; position: relative" ref="maindev">
        <div class="pagetop" :style="{ height: '100px' }" v-show="show_sel">
            <!-- height 32px 13 67%-->
            <table style="width: 100%; font-size: 12px" border="0">
                <col style="width: 5%" />
                <col style="width: 7%" />
                <col style="width: 1%" />
                <col style="width: 7%" />
                <col style="width: 5%" />
                <col style="width: 15%" />
                <col style="width: 5%" />
                <col style="width: 20%" />
                <col style="width: 5%" />
                <col style="width: 30%" />
                <tr>
                    <!-- <td>标本日期</td> -->
                    <td>
                        <el-dropdown @command="handleCommand" style="font-size: 12px;">
                            <u class="el-dropdown-link">
                                {{ datename }}
                            </u>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item command="标本日期">
                                    <font font-size="12px">标本日期</font>
                                </el-dropdown-item>
                                <el-dropdown-item command="审核日期">
                                    <font font-size="12px">审核日期</font>
                                </el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </td>
                    <td>
                        <el-date-picker v-model="sample_startdt" :able="false" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%; min-width: 100px" :picker-options="pickerOptions" :clearable="false" :key="startkey"> </el-date-picker>
                    </td>
                    <td align="center">至</td>
                    <td>
                        <el-date-picker v-model="sample_enddt" type="date" :able="false" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%; min-width: 100px" :picker-options="pickerOptions" :clearable="false" :key="endkey"> </el-date-picker>
                    </td>
                    <td>病人类型</td>
                    <td>
                        <el-select v-model="sel_pattypecode" @dblclick.native="popMultipleChk(sel_pattypecode, 'sel_pattypecode', pattypeOption, '病人类型选择')" filterable clearable style="width: 100%">
                            <el-option v-for="(item, index) in pattypeOption" :value="item.data" :label="item.display" :key="index"></el-option>
                        </el-select>
                    </td>
                    <td style="font-width: blod">{{ Qna }}</td>
                    <td colspan="1">
                        <el-input size="small" style="width: 100%" v-model="quicklyQ" :placeholder="currholder" ref="refQuicklyQ" @focus="Focus($event)" @keyup.enter.native="BtnchkQuery" id="refQuicklyQ"></el-input>
                    </td>
                    <td>
                        <!--  修改快捷查询的病人模糊查询 -->
                        <el-checkbox v-model="sel_patname_mh" true-label="1" false-label="0" style="padding-left: 5px; width: 70px" @focus="Focus($event)" @change="ChangeQ">姓名模糊 </el-checkbox>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td>报告单元多选</td>
                    <td colspan="3">
                        <rm-ddl-rptunit prgno="LIS410" :multiple_choice="true" v-model="sel_rptunitlist" clearable width="100%"></rm-ddl-rptunit>
                    </td>
                    <td>样本号</td>
                    <td>
                        <el-input size="small" style="width: 100%" placeholder="输入如1,2,5-8等格式" v-model="sel_sampleno" @focus="Focus($event)"></el-input>
                    </td>
                    <td>备注</td>
                    <td colspan="1">
                        <el-input size="small" style="width: 100%" v-model="sel_reportcomm" @dblclick.native="reportcommDlg = true" placeholder="手工输入 | 双击开窗"></el-input>
                    </td>
                    <td>
                        <rm_AdvancedSearch :jsonObj="jsonObj" ref="rm_AdvancedSearch" @openDialog="openDialog" @parentFunc="BtnQuery(0)" @showAdvancedTags="showAdvancedTags"> </rm_AdvancedSearch>
                    </td>
                    <td>
                    </td>
                </tr>
            </table>
            <table style="width: 100%; font-size: 12px" border="0">
                <col style="width: 80%" />
                <col style="width: 20%" />
                <tr>
                    <td style="text-align:left">
                        <el-button icon="el-icon-arrow-left" style="margin-right: 5px;" v-show="sTags.length > tagShowNum" :disabled="!disTagLeft" @click="leftTag" circle>
                        </el-button>
                        <el-tag :style="setTagCss" v-for="tag in showTags" :key="tag.refname" closable size="mini" :title="tag.title" :disable-transitions="true" :hit="true" @close="tagClose(tag)">
                            {{tag.displaytxt}}
                        </el-tag>
                        <el-button icon="el-icon-arrow-right" v-show="sTags.length > tagShowNum" :disabled="!disTagRight" @click="rightTag" circle>
                        </el-button>
                    </td>
                    <td style="text-align:right">
                        <el-button icon="el-icon-search" v-has="'PINQUERY'" type="primary" @click="BtnchkQuery()">查询(F8) </el-button>
                        <el-button icon="el-icon-search" v-has="'PINQUERY'" @click="BtnIDCardQuery()">身份证号查询 </el-button>
                        <el-button icon="el-icon-delete" @click="BtnClear(2)">清除</el-button>
                        <el-button icon="el-icon-aim" @click="BtnCheckRef">校验参考值</el-button>
                        <el-button v-has="'PPRINT'" @click.native="BtnPrint" icon="el-icon-printer">打印</el-button>
                        <el-button v-has="'PPRINT'" @click.native="BtnPreView" icon="el-icon-zoom-in">预览</el-button>
                        <el-button v-has="'PEXPORT'" @click.native="BtnExport" icon="el-icon-zoom-in">PDF导出</el-button>
                        <el-button v-has="'PPRINT'" @click.native="BtnAutoPrint" icon="el-icon-printer">自助测试</el-button>
                        <el-button v-has="'PVIEWCASE'" icon="el-icon-notebook-2" @click="QueryPatcase">查阅病历</el-button>
                    </td>
                </tr>
            </table>
        </div>
        <div class="pagecenter" :style="{ top: '105px' }">
            <!-- <div :style="middle_center"> -->
            <el-tabs style="height: 100%" type="border-card" v-model="tab_showflag" @tab-click="tabclick_Event">
                <el-tab-pane label="报告单" name="tab_report">
                    <rm-layout-right splitcolor="#ffffff" :splitwidth="2" :fixsize="475" :minfixsize="200" ref="layoutright">
                        <div style="height: calc(100% - 55px); bottom: 40px">
                            <vxe-table :data.sync="report_data" :loading="report_Loading" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border height="auto" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="reportTable" resizable show-overflow size="mini" :row-class-name="reportRowName" show-header-overflow :optimization="{ animat: false }" @current-change="reportchange_Event" :cell-class-name="reportCellName" @cell-dblclick="cellDblClickEvent" header-align="center" :start-index="(tablePage.currentPage - 1) * tablePage.pageSize">
                                <!-- @cell-click="cellClickEvent"  -->
                                <vxe-table-column field="alter_flag" sortable title="危" width="20" show-overflow align="center">
                                    <template v-slot="{ row, rowIndex, columnIndex }">
                                        <div :key="row.userno + rowIndex + columnIndex" v-if="row.alter_flag == '1' || row.alter_flag == '2'">
                                            <font color="#000000">危</font>
                                        </div>
                                        <div :key="row.userno + rowIndex + columnIndex" v-else></div>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="emer_flag" sortable title="急" width="20" show-overflow align="center">
                                    <template v-slot="{ row, rowIndex, columnIndex }">
                                        <div :key="row.userno + rowIndex + columnIndex" v-if="row.emer_flag == '1'">
                                            <font color="red">急</font>
                                        </div>
                                        <div :key="row.userno + rowIndex + columnIndex" v-else></div>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="redo_flag" sortable title="复" width="20" show-overflow align="center">
                                    <template v-slot="{ row, rowIndex, columnIndex }">
                                        <div :key="row.userno + rowIndex + columnIndex" v-if="row.redo_flag == '2' || row.redo_flag == '3'">
                                            <font color="#000000">复</font>
                                        </div>
                                        <div :key="row.userno + rowIndex + columnIndex" v-else></div>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="rechkflag" sortable title="审" width="20" show-overflow align="center">
                                    <template v-slot="{ row, rowIndex, columnIndex }">
                                        <div :key="row.userno + rowIndex + columnIndex" v-if="row.rechkflag == '9'">
                                            <font color="#000000">审</font>
                                        </div>
                                        <div :key="row.userno + rowIndex + columnIndex" v-else></div>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="print_count" sortable title="印" width="20" show-overflow align="center">
                                    <template v-slot="{ row, rowIndex, columnIndex }">
                                        <div :key="row.userno + rowIndex + columnIndex" v-if="row.print_count > 0">
                                            <font color="#000000">印</font>
                                        </div>
                                        <div :key="row.userno + rowIndex + columnIndex" v-else></div>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="rptunitname" sortable title="报告单元" width="130" show-overflow> </vxe-table-column>
                                <vxe-table-column align="center" field="sampledate" sortable title="标本日期" width="70" :formatter="['toDateString', 'yyyy-MM-dd']" show-overflow></vxe-table-column>
                                <vxe-table-column field="sampleno" align="center" sortable title="标本号" width="60" show-overflow :sort-width="20"></vxe-table-column>
                                <!--  添加打印选择-->
                                <vxe-table-column field="cp_selection" title="选择" width="40px" align="center">
                                    <template v-slot:header="{ column }">
                                        <el-checkbox v-model="selectall" @change="ChkAll($event)"></el-checkbox>
                                    </template>
                                    <template v-slot="{ row, rowIndex }">
                                        <el-checkbox v-model="row.cp_selection" true-label="1" false-label="0" @change="handleCheckedPrintChange(row, rowIndex)"></el-checkbox>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="pat_name" align="center" sortable title="病人姓名" width="60" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_no" sortable title="病人号" width="100" show-overflow> </vxe-table-column>
                                <vxe-table-column field="pat_sexname" align="center" sortable title="性别" width="35" show-overflow></vxe-table-column>
                                <vxe-table-column field="rechk_dt" align="center" sortable title="审核时间" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="rechk_user" align="center" sortable title="审核医生" width="60" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_id" sortable title="病人ID" width="130" show-overflow> </vxe-table-column>
                                <vxe-table-column field="req_reason" sortable title="送检目的" width="400" show-overflow> </vxe-table-column>
                                <vxe-table-column field="pat_agestr" align="center" sortable title="年龄" width="40" show-overflow></vxe-table-column>
                                <vxe-table-column field="specimen" sortable title="标本类型" width="90" show-overflow> </vxe-table-column>
                                <vxe-table-column field="req_bedno" align="center" sortable title="床号" width="50" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_typecodename" align="center" sortable title="病人类别" width="80" show-overflow></vxe-table-column>
                                <vxe-table-column field="barcode" sortable title="条码号" width="100" show-overflow> </vxe-table-column>
                                <vxe-table-column field="req_dept" sortable title="申请科室" width="150" show-overflow> </vxe-table-column>
                                <vxe-table-column field="req_ward" sortable title="病人病区" width="120" show-overflow> </vxe-table-column>
                                <vxe-table-column field="charge_typeno" align="center" sortable title="收费类别" width="90" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_diag" sortable title="临床诊断" width="250" show-overflow> </vxe-table-column>
                                <vxe-table-column field="req_dt" align="center" sortable title="申请时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="req_doc" align="center" sortable title="申请医生" width="70" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_cardno" sortable title="就诊卡号" width="110" show-overflow> </vxe-table-column>
                                <vxe-table-column field="inp_id" sortable title="就诊号" width="100" show-overflow> </vxe-table-column>
                                <vxe-table-column field="sampled_dt" align="center" sortable title="采样时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="recieve_dt" align="center" sortable title="接收时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="input_dt" align="center" sortable title="录入时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="test_info" sortable title="上机信息" width="120" show-overflow> </vxe-table-column>
                                <vxe-table-column field="test_dt" align="center" sortable title="上机时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="sample_archive" sortable align="center" title="归档位置" width="150"></vxe-table-column>
                                <vxe-table-column field="report_dt" align="center" sortable title="报告时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="tat_recieve_report" align="center" title="接收-报告(分钟)" width="100" show-overflow></vxe-table-column>
                                <vxe-table-column field="tat_sampled_recieve" align="center" title="采样-接收(分钟)" width="100" show-overflow></vxe-table-column>
                                <vxe-table-column field="report_user" align="center" sortable title="检验医生" width="70" show-overflow></vxe-table-column>
                                <vxe-table-column field="report_comm" sortable title="报告单备注" width="150" show-overflow> </vxe-table-column>
                                <vxe-table-column field="lab_advice" sortable title="实验室意见" width="100" show-overflow> </vxe-table-column>
                                <vxe-table-column field="item_num" align="center" sortable title="项目数" width="50" show-overflow></vxe-table-column>
                                <vxe-table-column field="instr_advice" sortable title="仪器辅助诊断" width="150" show-overflow></vxe-table-column>
                                <vxe-table-column field="rechk2_dt" align="center" sortable title="二审时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="rechk2_user" align="center" sortable title="二审医生" width="70" show-overflow></vxe-table-column>
                                <vxe-table-column field="lastprint_dt" align="center" sortable title="最后打印时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_birth" align="center" sortable title="病人生日" width="90" :formatter="['toDateString', 'yyyy-MM-dd']" show-overflow></vxe-table-column>
                                <vxe-table-column field="prereport_dt" align="center" sortable title="预计报告时间" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="reportid" sortable title="报告ID" width="160" show-overflow> </vxe-table-column>
                                <vxe-table-column field="hospcode" sortable title="送检医院" width="180" show-overflow> </vxe-table-column>
                                <vxe-table-column field="inp_date" align="center" sortable title="入院日期" width="140" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_phone" sortable title="联系电话" width="100" show-overflow> </vxe-table-column>
                                <vxe-table-column field="release_user" align="center" sortable title="发布人" width="70" show-overflow></vxe-table-column>
                                <vxe-table-column field="is_changed" align="center" sortable title="是否修改" width="70" show-overflow></vxe-table-column>
                                <vxe-table-column field="changed_afterreport" align="center" sortable title="打印、审核后修改" width="130" show-overflow></vxe-table-column>
                                <vxe-table-column field="unprint_flag" align="center" sortable title="禁止打印标志" width="100" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_diag_icd" sortable title="临床诊断标准码" width="160" show-overflow></vxe-table-column>
                                <vxe-table-column field="pat_address" sortable title="病人地址" width="200" show-overflow> </vxe-table-column>
                                <vxe-table-column field="pat_idcardno" align="center" sortable title="身份证/护照号" width="200" show-overflow></vxe-table-column>
                                <vxe-table-column field="print_count" align="center" sortable title="打印次数" width="60" show-overflow></vxe-table-column>
                                <vxe-table-column field="unprint_reason" sortable title="禁止打印原因" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="txtinfo1" header-align="center" align="left" sortable title="文字描述1 / 骨髓 分析/特征" width="200" show-overflow></vxe-table-column>
                                <vxe-table-column field="txtinfo2" header-align="center" align="left" sortable title="文字描述2 / 骨髓 结论" width="200" show-overflow></vxe-table-column>
                                <!-- <template v-slot:fix>
                                <div style="font-size:12px;padding-top:3px;background-color:#fff;"><span style="color:red;margin-left:10px;float:right;">合计: {{rpt_amount}}</span>
                                    <div style="clear:both"></div>
                                </div>
                            </template> -->
                            </vxe-table>
                        </div>
                        <div style="height: 52px">
                            <vxe-pager :loading="report_Loading" :current-page="tablePage.currentPage" :page-size="tablePage.pageSize" :total="tablePage.total" :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']" @page-change="handlePageChange"></vxe-pager>
                        </div>
                        <template v-slot:fix>
                            <el-tabs style="height: 100%" type="border-card" v-model="tab_rshowflag" @tab-click="tabclick_Event">
                                <el-tab-pane label="检验结果" name="tab_result">
                                    <div v-if="rpttype == '2'" class="right-inser">
                                        <!-- <div v-if="is_ym" class="right-inser"> -->
                                        <div class="middle-tab-top">
                                            <vxe-table :data.sync="result_data" :loading="result_Loading" header-align="center" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border height="200px" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="ymresulttable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{ animat: false }" @current-change="resultChange">
                                                <vxe-table-column field="rpt_itemname" sortable title="检验项目" width="220" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result_str" sortable title="检测结果" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result1" sortable title="菌落计数" width="150" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result4" sortable title="耐药机制" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="instrna" sortable title="检验仪器" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="interno" sortable title="通道号" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="alertflag" align="center" sortable title="危急标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result_flag" align="center" sortable title="结果标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="redo_flag" align="center" sortable title="复查标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="redo_result" sortable title="复查前结果" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column field="orig_result_num" sortable title="原始数值结果" width="150" show-overflow></vxe-table-column>
                                                <vxe-table-column field="orig_result_str" sortable title="原始文本结果" width="150" show-overflow></vxe-table-column>
                                                <vxe-table-column field="modify_flag" sortable title="修改标志" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="first_dt" align="center" sortable title="第一次填入时间" width="120" show-overflow></vxe-table-column>
                                                <vxe-table-column field="last_dt" align="center" sortable title="最后修改时间" width="120" show-overflow></vxe-table-column>
                                                <vxe-table-column field="last_user" align="center" sortable title="最后修改人" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column field="rptunitna" sortable title="报告单元" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="germflag" align="center" sortable title="细菌标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="orig_result_flag" align="center" sortable title="原始结果标志" width="60" show-overflow></vxe-table-column>
                                            </vxe-table>
                                            <div class="fixtotal">
                                                <div style="font-size: 12px; padding-top: 3px; background-color: #fff">
                                                        <span style="color: red; margin-left: 10px; float: right">合计: {{ result_amount }}</span>
                                                        <div style="clear: both"></div>
                                                    </div>
                                                </div>
                                        </div>
                                        <div class="middle-tab-bottom">
                                            <vxe-table :data.sync="resusltmed_date" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border header-align="center" :height="ymresultheight" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="ymresulttable2" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{ animat: false }">
                                                <vxe-table-column field="medname" sortable title="抗生素" width="220" show-overflow></vxe-table-column>
                                                <vxe-table-column field="medresult" sortable title="药敏结果" header-align="center" align="center" width="60" show-overflow>
                                                    <template v-slot="{ row }">
                                                        <div :style="{
                                                                background: row.cp_resultbackgroundcolor,
                                                                color: row.cp_resultcolor,
                                                            }" style="padding: 0px 10px">
                                                            {{ row.medresult }}
                                                        </div>
                                                    </template>
                                                </vxe-table-column>
                                                <vxe-table-column field="rad" sortable title="Rad" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="mic" sortable title="Mic" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result_flag" align="center" sortable title="标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result6" sortable title="参考范围" width="120" show-overflow></vxe-table-column>
                                                <vxe-table-column field="expertresult" sortable title="专家值" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="medgroup" align="center" sortable title="分组" width="80" show-overflow></vxe-table-column>
                                            </vxe-table>
                                            <div class="fixtotal">
                                                <div style="font-size: 12px; padding-top: 3px; background-color: #fff">
                                                        <span style="color: red; margin-left: 10px; float: right">合计: {{ ymresultitem_amount }}</span>
                                                        <div style="clear: both"></div>
                                                    </div>
                                                </div>
                                        </div>
                                    </div>
                                    <div v-else-if="rpttype == '4'" class="right-inser">
                                        <div style="height:100%;width:100%">
                                            <vxe-table ref="xTable" :data="result_data" :loading="result_Loading" :sort-config="{ trigger: 'cell' }" border fit height="auto" header-align="center" resizable show-overflow="title" size="mini" stripe highlight-current-row>
                                                <vxe-table-column field="rpt_itemname" sortable title="检验项目" width="220" show-overflow>
                                                    <template v-slot="{ row }">
                                                        <div v-if="row.alertflag == '1'" style="background: red; padding: 0px 10px">
                                                            {{ row.rpt_itemname }}
                                                        </div>
                                                        <div v-else style="padding: 0px 10px">
                                                            {{ row.rpt_itemname }}
                                                        </div>
                                                    </template>
                                                </vxe-table-column>
                                                <vxe-table-column field="result2" sortable :title="marrowshowmode=='2' ? '血片%': '血片'" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result3" sortable :title="marrowshowmode=='2' ? '髓片%': '髓片'" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column v-if="showresult3 == '1'" field="result5" sortable :title="marrowshowmode=='2' ? '印片%': '印片'" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column v-if="marrowshowmode != '3'" field="result_str" sortable :title="marrowshowmode=='1' ? '血片%': '血片'" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column v-if="marrowshowmode != '3'" field="result1" sortable :title="marrowshowmode=='1' ? '髓片%': '髓片'" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column v-if="marrowshowmode != '3' && showresult3 == '1'" field="result4" sortable :title="marrowshowmode=='1' ? '印片%': '印片'" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result_unit" sortable title="单位" width="70" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result_ref" sortable title="参考值" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="refaverg" sortable title="参考均值" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="refstdev" sortable title="参考SD" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="instrna" sortable title="检验仪器" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="interno" sortable title="通道号" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="alertflag" align="center" sortable title="危急标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result_flag" align="center" sortable title="结果标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="redo_flag" align="center" sortable title="复查标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="redo_result" sortable title="复查前结果" width="120" show-overflow></vxe-table-column>
                                                <vxe-table-column field="modify_flag" align="center" sortable title="修改标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="first_dt" align="center" ortable title="第一次填入时间" width="120" show-overflow></vxe-table-column>
                                                <vxe-table-column field="last_dt" align="center" sortable title="最后修改时间" width="120" show-overflow></vxe-table-column>
                                                <vxe-table-column field="last_user" align="center" sortable title="最后修改人" width="80" show-overflow></vxe-table-column>
                                                <vxe-table-column field="rptunitna" sortable title="报告单元" width="150" show-overflow></vxe-table-column>
                                            </vxe-table>
                                            <div class="fixtotal">
                                                <div style="font-size: 12px; padding-top: 3px; background-color: #fff">
                                                        <span style="color: red; margin-left: 10px; float: right">合计: {{ result_amount }}</span>
                                                        <div style="clear: both"></div>
                                                    </div>
                                                </div>
                                        </div>
                                    </div>
                                    <div v-else-if="rpttype == '1'" class="right-inser">
                                        <vxe-table :data.sync="result_data" :loading="result_Loading" header-align="center" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border :height="resultheight" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="resulttable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{ animat: false }">
                                            <vxe-table-column field="rpt_itemname" sortable title="检验项目" width="220" show-overflow>
                                                <template v-slot="{ row }">
                                                    <div v-if="row.alertflag == '1'" style="background: red; padding: 0px 10px">
                                                        {{ row.rpt_itemname }}
                                                    </div>
                                                    <div v-else style="padding: 0px 10px">
                                                        {{ row.rpt_itemname }}
                                                    </div>
                                                </template>
                                            </vxe-table-column>
                                            <vxe-table-column field="result_str" sortable title="检测结果" width="80" show-overflow>
                                                <template v-slot="{ row }">
                                                    <div :style="{
                                                            background: row.cp_resultbackgroundcolor,
                                                            color: row.cp_resultcolor,
                                                        }" style="padding: 0px 10px">
                                                        {{ row.result_str }}
                                                    </div>
                                                </template>
                                            </vxe-table-column>
                                            <vxe-table-column field="result_unit" sortable title="单位" width="70" show-overflow></vxe-table-column>
                                            <vxe-table-column field="result_ref" sortable title="参考值" width="100" show-overflow></vxe-table-column>
                                            <vxe-table-column field="result1" :title="result1text" width="70px" v-if="result1 == '1'"></vxe-table-column>
                                            <vxe-table-column field="result2" :title="result2text" width="70px" v-if="result2 == '1'"></vxe-table-column>
                                            <vxe-table-column field="result3" :title="result3text" width="70px" v-if="result3 == '1'"></vxe-table-column>
                                            <vxe-table-column field="result_txt" sortable title="大文本结果" width="130" show-overflow></vxe-table-column>
                                            <vxe-table-column field="instrna" sortable title="检验仪器" width="100" show-overflow></vxe-table-column>
                                            <vxe-table-column field="interno" sortable title="通道号" width="100" show-overflow></vxe-table-column>
                                            <vxe-table-column field="alertflag" align="center" sortable title="危急标志" width="60" show-overflow></vxe-table-column>
                                            <vxe-table-column field="result_flag" align="center" sortable title="结果标志" width="60" show-overflow></vxe-table-column>
                                            <vxe-table-column field="redo_flag" align="center" sortable title="复查标志" width="60" show-overflow></vxe-table-column>
                                            <vxe-table-column field="redo_result" sortable title="复查前结果" width="120" show-overflow></vxe-table-column>
                                            <vxe-table-column field="orig_result_num" sortable title="原始数值结果" width="120" show-overflow></vxe-table-column>
                                            <vxe-table-column field="orig_result_str" sortable title="原始文本结果" width="120" show-overflow></vxe-table-column>
                                            <vxe-table-column field="modify_flag" align="center" sortable title="修改标志" width="60" show-overflow></vxe-table-column>
                                            <vxe-table-column field="first_dt" align="center" ortable title="第一次填入时间" width="120" show-overflow></vxe-table-column>
                                            <vxe-table-column field="last_dt" align="center" sortable title="最后修改时间" width="120" show-overflow></vxe-table-column>
                                            <vxe-table-column field="last_user" align="center" sortable title="最后修改人" width="80" show-overflow></vxe-table-column>
                                            <vxe-table-column field="rptunitna" sortable title="报告单元" width="150" show-overflow></vxe-table-column>
                                            <vxe-table-column field="germflag" align="center" sortable title="细菌标志" width="60" show-overflow></vxe-table-column>
                                            <vxe-table-column field="orig_result_flag" align="center" sortable title="原始结果标志" width="160" show-overflow></vxe-table-column>
                                        </vxe-table>
                                        <div class="fixtotal">
                                            <div style="font-size: 12px; padding-top: 3px; background-color: #fff">
                                                    <span style="color: red; margin-left: 10px; float: right">合计: {{ result_amount }}</span>
                                                    <div style="clear: both"></div>
                                                </div>
                                            </div>
                                    </div>
                                    <div v-else-if="rpttype == '3'" class="right-inser">
                                        <div style="height: calc(100% - 5px); width: calc(100% - 5px)">
                                            <!-- <el-image :src="image" style="width:100%;height:100%"></el-image> -->
                                            <iframe :src="image" style="width: 100%; height: 100%"></iframe>
                                            <!-- <div style="width:100%;height:100%" v-html="image"></div> -->
                                            <!-- <pdf v-for="i in pdfPages" :key="i" :src="url" :page="i"></pdf> -->
                                        </div>
                                    </div>
                                </el-tab-pane>
                                <el-tab-pane v-if="bShowRpt" label="报告单预览" name="tab_rpt">
                                    <vxe-table :data="rptData" :sort-config="{ trigger: 'cell' }" border fit height="100%" header-align="center" highlight-current-row highlight-hover-row highlight-hover-column ref="rptTable" resizable size="mini" stripe show-header-overflow="tooltip" show-overflow="tooltip" :key="rptviewkey" @cell-dblclick="BtnPreViewRpt">
                                        <vxe-table-column align="center" field="create_dt" sortable title="创建日期" width="120" :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']" show-overflow></vxe-table-column>
                                        <vxe-table-column sortable field="validflagname" title="有效性" width="50" align="center"></vxe-table-column>
                                    </vxe-table>
                                </el-tab-pane>
                                <el-tab-pane v-if="rpttype == '4'" label="分析 /特征和结论">
                                    <table style="width:100%;height:100%">
                                        <tr>
                                            <td style="text-align:left;font-size:12px;height:20px;font-weight:bold">
                                                分析/特征
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <el-input type="textarea" :rows="12" resize="none" :readonly="true" style="height:100%;width:100%;padding:0 0 0 0px" :maxlength="4095" v-model="txtinfo1"></el-input>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:left;font-size:12px;height:20px;font-weight:bold">结论</td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <el-input type="textarea" :rows="12" resize="none" :readonly="true" style="height:100%;width:100%;padding:0 0 0 0px" :maxlength="4095" v-model="txtinfo2"></el-input>
                                            </td>
                                        </tr>
                                    </table>
                                </el-tab-pane>
                            </el-tabs>
                        </template>
                    </rm-layout-right>
                </el-tab-pane>
                <el-tab-pane label="申请单" name="tab_master">
                    <vxe-table :data.sync="master_data" :loading="master_Loading" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border height="auto" header-align="center" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="mastertable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{ animat: false }" @cell-dblclick="reqDblClickEvent" :row-class-name="RowClassName">
                        <vxe-table-column field="pat_typename" title="病人类型" width="60px" sortable align="center"></vxe-table-column>
                        <vxe-table-column field="report_dt" title="报告时间" align="center" width="120px"> </vxe-table-column>
                        <vxe-table-column field="pat_no" sortable title="病历号" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_name" title="病人姓名" width="70px" sortable align="center"></vxe-table-column>
                        <vxe-table-column field="req_groupna" sortable title="分单类别" width="100" show-overflow align="center"> </vxe-table-column>
                        <vxe-table-column field="barcode" sortable title="条形码" align="center" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="emer_flag" align="center" sortable title="急" :formatter="['formatSelect', emer_flagOptions]" width="25" show-overflow>
                            <template v-slot="{ row }">
                                <div v-if="row.emer_flag == '1'">
                                    <font color="red" style="font-weight: 600; font-size: 14px">急</font>
                                </div>
                                <div v-else></div>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="sample_items" sortable title="申请项目(描述)" width="350" show-overflow> </vxe-table-column>
                        <vxe-table-column field="amount" align="right" sortable title="实收金额" width="80" show-overflow header-align="center"> </vxe-table-column>
                        <vxe-table-column field="req_statname" align="center" sortable title="状态" width="60" show-overflow></vxe-table-column>
                        <vxe-table-column field="create_dt" align="center" sortable title="创建时间" width="120" show-overflow></vxe-table-column>
                        <vxe-table-column field="recieve_dt" title="接收时间" width="120px" align="center"> </vxe-table-column>
                        <vxe-table-column field="recieve_username" title="接收人" width="70px" align="center"> </vxe-table-column>
                        <vxe-table-column field="test_dt" title="上机时间" align="center" width="120px"></vxe-table-column>
                        <vxe-table-column field="test_username" title="上机人" width="70px" align="center"> </vxe-table-column>
                        <vxe-table-column field="req_deptname" sortable title="申请科室" width="120" show-overflow> </vxe-table-column>
                        <vxe-table-column field="req_docname" sortable title="申请医生" width="80" align="center" show-overflow> </vxe-table-column>
                        <vxe-table-column field="req_bedno" align="center" sortable title="床号" width="70" show-overflow> </vxe-table-column>
                        <vxe-table-column field="specimen_name" align="center" sortable title="标本类型" width="100" show-overflow></vxe-table-column>
                        <vxe-table-column field="pat_sexname" align="center" sortable title="性别" width="50" show-overflow></vxe-table-column>
                        <vxe-table-column field="pat_agestr" align="center" sortable title="年龄" width="70" show-overflow></vxe-table-column>
                        <vxe-table-column field="base_amount" align="right" sortable title="应收金额" width="100" show-overflow header-align="center"></vxe-table-column>
                        <vxe-table-column field="create_username" align="center" sortable title="创建人" width="70" show-overflow></vxe-table-column>
                        <vxe-table-column field="print_dt" align="center" sortable title="打印/执行时间" width="120" show-overflow></vxe-table-column>
                        <vxe-table-column field="print_username" align="center" sortable title="打印/执行人" width="110" show-overflow></vxe-table-column>
                        <vxe-table-column field="print_count" align="center" sortable title="打印次数" width="80" show-overflow></vxe-table-column>
                        <vxe-table-column field="sampled_dt" align="center" sortable title="采样时间" width="120" show-overflow></vxe-table-column>
                        <vxe-table-column field="sampled_username" align="center" sortable title="采样人" width="70" show-overflow></vxe-table-column>
                        <vxe-table-column field="req_dt" align="center" sortable title="申请时间" width="120" show-overflow> </vxe-table-column>
                        <vxe-table-column field="release_dt" align="center" sortable title="发布时间" width="140" show-overflow></vxe-table-column>
                        <vxe-table-column field="prereport_dt" align="center" sortable title="预出报告时间" width="120" show-overflow></vxe-table-column>
                        <vxe-table-column field="prereport_comm" sortable title="报告领取说明" width="150" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_diag" sortable title="临床诊断" width="150" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_id" sortable title="病人ID" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="inp_date" align="center" sortable title="入院日期" width="120" show-overflow></vxe-table-column>
                        <vxe-table-column field="send_dt" align="center" sortable title="送出时间" width="120" show-overflow></vxe-table-column>
                        <vxe-table-column field="send_username" sortable title="送出人" width="70" show-overflow align="center"> </vxe-table-column>
                        <vxe-table-column field="charge_dt" align="center" sortable title="计价时间" width="120" show-overflow></vxe-table-column>
                        <vxe-table-column field="charge_username" sortable title="计价人" width="70" show-overflow align="center"> </vxe-table-column>

                        <vxe-table-column field="chargeex_flag" sortable title="计价标志" width="100" show-overflow header-align="center"></vxe-table-column>
                        <vxe-table-column field="report_username" title="检验医生姓名" align="center" width="80px"> </vxe-table-column>
                        <vxe-table-column field="rechk_username" title="核对医生姓名" align="center" width="80px"> </vxe-table-column>
                        <vxe-table-column field="sampled_chkusername" title="采样核对者" align="center" width="100px"> </vxe-table-column>
                        <vxe-table-column field="reqsource" sortable title="申请单来源" :formatter="['formatSelect', reqsourceOptions]" width="150" show-overflow> </vxe-table-column>
                        <vxe-table-column field="recieve1_dt" title="工作组接收时间" width="100px" sortable></vxe-table-column>
                        <vxe-table-column field="recieve1_username" title="工作组接收用户" width="100px" sortable></vxe-table-column>
                        <vxe-table-column field="cancel_dt" title="作废时间" width="120px" sortable></vxe-table-column>
                        <vxe-table-column field="cancel_username" title="作废用户" width="100px" sortable align="center"></vxe-table-column>
                        <vxe-table-column field="alter_flag" sortable title="报警" width="60" show-overflow> </vxe-table-column>
                        <vxe-table-column field="saleman" sortable title="销售人" align="center" width="70" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_cardno" sortable title="就诊卡号" width="120" show-overflow> </vxe-table-column>
                        <vxe-table-column field="req_comm" sortable title="医生备注" width="150" show-overflow> </vxe-table-column>
                        <vxe-table-column field="reject_dt" title="退回时间" align="center" width="120px"> </vxe-table-column>
                        <vxe-table-column field="reject_username" title="退回用户" align="center" width="80px"> </vxe-table-column>
                        <vxe-table-column field="reject_reason" title="退回原因" width="150px"></vxe-table-column>
                        <vxe-table-column field="reject_count" title="退回次数" align="center" width="60px"> </vxe-table-column>
                        <vxe-table-column field="pat_birth" sortable title="生日" align="center" width="100" show-overflow></vxe-table-column>
                        <vxe-table-column field="pat_agestr" sortable title="年龄岁数" align="center" width="80" show-overflow></vxe-table-column>
                        <vxe-table-column field="inp_id" sortable title="住院标志" align="center" width="80" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_diag_icd" sortable title="诊断标准代码" width="150" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_address" sortable title="地址" width="150" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_nation" sortable title="国籍" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_idcardno" sortable title="身份证号" align="center" width="130" show-overflow></vxe-table-column>
                        <vxe-table-column field="pat_phone" sortable title="联系电话" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="charge_typeno" sortable title="费别代码" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="perform_deptname" sortable title="执行科室" width="150" show-overflow> </vxe-table-column>
                        <vxe-table-column field="req_ward" sortable title="病区代码" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="original_reqno" sortable title="原始单号" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="secrecy" sortable title="加密" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="other_stat" sortable title="其它状态" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="specimen_code" sortable title="标本类型代码" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="sample_detail" sortable title="标准备注说明" width="150" show-overflow> </vxe-table-column>
                        <vxe-table-column field="req_reason" sortable title="送检目的" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="pat_height" sortable title="身高(CM)" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="weight" sortable title="体重(KG)" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="abo_bldtype" sortable title="ABO血型" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="rh_bldtype" sortable title="RH血型" width="100" show-overflow> </vxe-table-column>
                        <vxe-table-column field="discard_username" sortable title="遗弃人" align="center" width="70" show-overflow></vxe-table-column>
                        <vxe-table-column field="discard_dt" sortable title="遗弃时间" align="center" width="120" show-overflow></vxe-table-column>
                        <!-- <template v-slot:fix>
                            <div style="font-size: 17px; padding-top: 3px; background-color: #fff;text-align: center">
                                <span style="color: red; ">共{{ sum_row }}条数据，实收金额合计: {{ sum_amount }}</span>
                            </div> -->
                            <!-- <span style="color:blue;margin-left:60px">{{tempRowIndex+1}}/{{TotalPatNum}}</span> -->
                        <!-- </template> -->
                    </vxe-table>
                    <div class="fixtotal">
                        <div style="font-size: 17px; padding-top: 3px; background-color: #fff;text-align: center">
                                <span style="color: red; ">共{{ sum_row }}条数据，实收金额合计: {{ sum_amount }}</span>
                            </div>
                            <!-- <span style="color:blue;margin-left:60px">{{tempRowIndex+1}}/{{TotalPatNum}}</span> -->
                        </div>
                    
                </el-tab-pane>
            </el-tabs>
            <!-- </div> -->
        </div>
        <el-dialog v-el-drag-dialog :close-on-click-modal="false" title="参考值校验" destroy-on-close :visible.sync="dialogCheckRefVisible" width="900px">
            <template>
                <div style="height: 500px; width: 100%; position: relative">
                    <div class="poppagetop">
                        <div style="float: left; width: 50%; text-align: left; color: blue">校验数: {{ check_num }}/{{ check_amount }}</div>
                        <div style="float: left; width: 50%; text-align: right">
                            <el-button icon="el-icon-switch-button" @click="checkflag = 0">停止</el-button>
                            <el-button icon="el-icon-upload2" @click="recordexport" v-has="'PEXPORT'">导出</el-button>
                            <el-button icon="el-icon-close" @click="dialogCheckRefVisible = false">关 闭 </el-button>
                        </div>
                    </div>
                    <div class="poppagecenter">
                        <vxe-table show-overflow ref="refxTable" height="auto" :data.sync="checkRefData" show-header-overflow highlight-current-row highlight-hover-row resizable border size="mini" :span-method="rowspanMethod" header-align:center>
                            <vxe-table-column type="index" title="NO." width="40"></vxe-table-column>
                            <vxe-table-column field="labgroupname" title="工作组" width="100" header-align="center"> </vxe-table-column>
                            <vxe-table-column field="rptunitname" title="报告单元" width="130" header-align="center" class="rowspantop"></vxe-table-column>
                            <vxe-table-column field="rpt_itemname" title="报告项目" width="160" header-align="center" float:top> </vxe-table-column>
                            <vxe-table-column field="diffstr" title="参考值差异" width="250" header-align="center"> </vxe-table-column>
                            <vxe-table-column field="specimen_name" title="标本类型" width="100" header-align="center"> </vxe-table-column>
                            <!-- <vxe-table-column field="pat_name" title="姓名" width="60" header-align="center">
                            </vxe-table-column> -->
                            <vxe-table-column field="pat_sex" title="性别" width="40" header-align="center" align="center"> </vxe-table-column>
                            <vxe-table-column field="pat_agestr" title="年龄" width="50" header-align="center"> </vxe-table-column>
                            <vxe-table-column field="req_deptname" title="科室" width="120" header-align="center"> </vxe-table-column>
                            <vxe-table-column field="pat_diag_icd" title="诊断" width="100" header-align="center"> </vxe-table-column>
                            <vxe-table-column field="physicycle" title="生理周期" width="100" header-align="center"> </vxe-table-column>

                            <vxe-table-column field="sampledate" title="标本日期" width="100" header-align="center" align="center"> </vxe-table-column>
                            <vxe-table-column field="sampleno" title="标本号" width="100" header-align="center"> </vxe-table-column>
                            <vxe-table-column field="pat_ageyear" title="年龄数值" width="80" header-align="center"> </vxe-table-column>
                        </vxe-table>
                    </div>
                </div>
            </template>
        </el-dialog>
        <el-dialog v-el-drag-dialog :close-on-click-modal="false" title="校验完成" destroy-on-close :visible.sync="dialogErrCheckVisible" width="400px" height="50%">
            <template>
                <div v-for="msg in msglist" :key="msg.title" style="over-flow: auto">
                    <h3 style="color: red">{{ msg }}</h3>
                </div>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="dialogErrCheckVisible = false" :autofocus="true">确 定</el-button>
                </div>
            </template>
        </el-dialog>
        <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择备注" :visible.sync="reportcommDlg">
            <rm-pop-common ref="popcom" @change="reportcommchange" @cancel="reportcommDlg = false" kindno="reportcomm" datatype="seccode"></rm-pop-common>
        </el-dialog>
        <!--多选弹窗--->
        <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="dlgTitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
            <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="closedialog"> </rm-SqlMultiple>
        </el-dialog>
        <el-dialog width="600px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="dlgTitle" :visible.sync="bExportSettingsVisible" :destroy-on-close="true">
            <div style="width: 100%; height: 380px">
                <table style="font-size: 12px; white-space: nowrap" border="0">
                    <tr>
                        <td align="right"><b>文件名称</b></td>
                        <td>
                            <el-input v-model="exportFileTitle" placeholder="" style="width: 500px"></el-input>
                        </td>
                    </tr>
                    <tr style="height: 10px"></tr>
                    <tr>
                        <td align="right" style="width: 20%"><b>命名说明</b></td>
                    </tr>
                </table>
                <table style="width: 100%; ont-size: 10px; text-align: left">
                    <col style="width: 40px" />
                    <col style="width: 150px" />
                    <col style="width: 150px" />
                    <col style="width: 150px" />
                    <col style="width: 40px" />
                    <tr>
                        <td></td>
                        <td style="text-align: left">@reportid = 报告ID</td>
                        <td style="text-align: left">@sampledate = 报告日期</td>
                        <td style="text-align: left">@sampleno = 标本号</td>
                        <td></td>
                    </tr>
                    <tr style="text-align: left">
                        <td></td>
                        <td style="text-align: left">@barcode = 条码号</td>
                        <td style="text-align: left">@rptunitid = 报告单元</td>
                        <td style="text-align: left">@pat_name = 病人姓名</td>
                        <td></td>
                    </tr>
                    <tr style="text-align: left">
                        <td></td>
                        <td style="text-align: left">@pat_idcardno = 身份证</td>
                        <td style="text-align: left">@pat_no = 病历号</td>
                        <td style="text-align: left">@req_reason = 送检目的</td>
                        <td></td>
                    </tr>
                    <tr style="text-align: left">
                        <td></td>
                        <td style="text-align: left">@hospcode = 送检医院</td>
                        <td></td>
                    </tr>
                </table>
                <table style="font-size: 12px; white-space: nowrap" border="0">
                    <tr style="height: 10px"></tr>
                    <tr>
                        <td align="right"><b>命名示例</b></td>
                        <td>
                            <el-input v-model="exampleTitle" placeholder="" style="width: 500px" :disabled="true"> </el-input>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td style="text-align: left"><b>&nbsp;&nbsp;&nbsp;2020-08-08_006_血球XT-4000I_12345_张三.pdf</b></td>
                    </tr>
                    <tr style="height: 10px"></tr>
                </table>
                <div style="overflow-x: auto; overflow-y: auto; width: 100%; float: left; height: 130px; border: 1px solid #ccc">
                    <template>
                        <div style="over-flow: scroll">
                            <h3 v-for="msg in logList" :key="msg" style="color: black; font-size: 11px">{{ msg }}</h3>
                        </div>
                    </template>
                </div>
                <span style="height:30px;width::100%; text-align: right;box-sizing: border-box;float: right">
                    <h3 v-if="sel_mergePdf == 1" style="color: black; font-size: 11px; float: left; margin-top: 2px;">当勾选多个报告导出时，合并后的PDF文件以当前时间命名。</h3>
                    <el-checkbox v-model="sel_mergePdf" true-label="1" false-label="0" style="padding-right: 20px; ">导出时合并PDF </el-checkbox>
                    <el-button @click="BtnRptExport">导出 </el-button>
                    <!-- <el-button @click="BtnCurrentExport">导出选中 </el-button>
                    <el-button @click="BtnBatchExport">导出全部</el-button> -->
                    <el-button @click="bExportSettingsVisible = false">取 消 </el-button>
                </span>
            </div>
        </el-dialog>
        <!--  添加打印检查提醒 -->
        <el-dialog width="600px" height="205px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="dlgTitle" :visible.sync="dialogPrintchk" :destroy-on-close="true">
            <div style="width: 100%; height: 155px">
                <div style="overflow-x: auto; overflow-y: auto; width: 100%; float: left; height: 130px; border: 1px solid #ccc">
                    <template>
                        <div style="over-flow: scroll">
                            <h3 v-for="msg in forbidList" :key="msg" style="color: black; font-size: 11px">{{ msg }}</h3>
                        </div>
                    </template>
                </div>
                <span style="height:25px;width::100%; text-align: right;box-sizing: border-box;float: right">
                    <el-button @click="dialogPrintchk = false">确定 </el-button>
                </span>
            </div>
        </el-dialog>
        <!-- 批量打印提示-->
        <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" v-el-drag-dialog :close-on-click-modal="false">
            <div style="font-size: 18px; font-weight: 800">{{ printmsg }}</div>
        </el-dialog>
        <!-- 选人弹窗-->
        <el-dialog title="选择病人" :visible.sync="dialogSelPatVisible" width="490px" v-el-drag-dialog :close-on-click-modal="false">
            <div style="width: 100%; display: block;">
                <span style="color:red; float:left;">双击或勾选后点击确定选择病人</span>
                <el-button style="float:right;" type="primary" @click="checkPeopleClickEvent">确 定</el-button>
            </div>
            <div style="width: 100%; float:left; padding-top: 5px;">
                <vxe-table :data.sync="checkPeople_data" border height="250px" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow show-overflow size="mini" show-header-overflow ref="tablepeople" @cell-dblclick="checkPeopleDblClickEvent" header-align="center">
                    <vxe-table-column type="selection" width="30" align="center"></vxe-table-column>
                    <vxe-table-column field="pat_no" title="病人号" align="center" width="100px"> </vxe-table-column>
                    <vxe-table-column field="pat_cardno" title="卡号" align="center" width="100px"> </vxe-table-column>
                    <vxe-table-column field="pat_name" title="病人姓名" align="center" width="100px"> </vxe-table-column>
                    <vxe-table-column field="pat_idcardno" title="身份证" align="center" width="120px"> </vxe-table-column>
                </vxe-table>
            </div>
        </el-dialog>
    </div>
</template>


<script>
import { Promise } from "q";
import { invalid } from "moment";
import XE from "xe-utils"; //引入工具类
XE.mixin({
    // 自定义全局的格式化处理函数
    formatSelect(cellValue, list) {
        let item = list.find((item) => item.value == cellValue);
        return item ? item.label : "";
    },
});
export default {
    name: "LIS410",
    data() {
        const _that = this;
        return {
            tablePage: {
                currentPage: 1,
                pageSize: 5000,
                total: 0,
            },
            rptviewkey: 0,
            rptData: [],
            bShowRpt: false,
            pagetopstyle: {
                height: "150px",
            },
            pagecenter: {
                position: "absolute",
                top: "154px",
                bottom: "0px",
                overflow: "auto",
                width: "100%",
                left: "0px",
            },
            currholder: "病人号,病人ID,卡号,姓名,条码号,报告ID,身份证",
            icon_showselother: "el-icon-caret-bottom",
            Qna: "快捷查询",
            show_sel: true,
            report_Loading: false,
            report_data: [],
            tab_showflag: "tab_report",
            tab_rshowflag: "tab_result",
            fieldname: "",
            dlgTitle: "",
            quicklyQ: "",
            sel_rptunit: "",
            sel_rptunitlist: "",
            sel_patno: "",
            sel_patcardno: "",
            sel_reqbedno: "",
            sel_reportcomm: "",
            sel_reqreason: "",
            sel_result4: "",
            forbidList: [],
            // sample_startdt: XE.toDateString(XE.getWhatDay(new Date(), -5), "yyyy-MM-dd"),
            // sample_enddt: XE.toDateString(new Date(), "yyyy-MM-dd"),
            sample_startdt: this.$pub.InitDateTime2(0).datefrom,
            sample_enddt: this.$pub.InitDateTime2(0).dateto,
            // sel_date: ["2009-08-08", "2020-01-01"],
            sel_patname: "",
            sel_patname_mh: "0",
            sel_quick_query_patno: "0",
            sel_pattypecode: "",
            sel_specimencode: "",
            sel_sampleno: "",
            sel_emerflag: "all",
            sel_reqdeptno: "",
            sel_chargetypeno: "",
            sel_chkflag: "all",
            sel_mixrpt: "0",
            sel_rflag: "all",
            sel_rptitemcode: "",
            sel_resultnum1: "",
            sel_resultnum2: "",
            sel_barcode: "",
            sel_reqdocno: "",
            sel_specimencomm: "all",
            sel_sampleduser: "",
            sel_patdiag: "",
            sel_reportuser: "",
            sel_reqwardno: "",
            sel_itemcombid: "",
            sel_allprint: false,
            sel_isprint: "all",
            sel_ischeck: "all",
            sel_pat_idcardno: "",
            sel_rechkuser: "",
            sel_combno: "",
            sel_outsex: false,
            sel_mh_patno: false,
            sel_onlymed: false,
            sel_markno: false,
            sel_txtinfo1: "",
            sel_txtinfo2: "",
            sel_hospitalcode: "",
            sel_pat_hospcode: "",
            macaddress: "",
            sel_onlyouthospital: false,
            show_right: true,
            is_ym: false, //是否显示药敏
            rpttype: "1",
            result_data: [],
            checkPeople_data: [],
            result_Loading: false,
            resusltmed_date: [],
            master_data: [],
            checkRefData: [],
            master_Loading: false,
            dialogMultipleVisible: false,
            dialogCheckRefVisible: false, //校验参考值
            dialogErrCheckVisible: false, //
            dialogPrintchk: false,
            reportheight: "auto",
            resultheight: "auto",
            ymresultheight: "auto",
            startkey: 0,
            endkey: 0,
            rpt_amount: 0,
            check_amount: 0,
            check_num: 0,
            sum_row: 0,
            sum_amount: 0, //实收金额求和
            result_amount: 0,
            ymresult_amont: 0,
            ymresultitem_amount: 0,
            printReportid: "",
            reportid: "",
            rechkflag: "",
            unprint_flag: "",
            option1: [],
            option2: [],
            pattypeOption: [],
            rescodeOption: [],
            rptunitAll: [],
            newArray: [],
            checkObj: {},
            msglist: [],
            result1text: "",
            result2text: "",
            result3text: "",
            result1: "",
            result2: "",
            result3: "",
            emer_flagOptions: [
                { label: "", value: "0" },
                { label: "急", value: "1" },
            ],
            reqsourceOptions: [
                { label: "读取外部系统申请单", value: "0" },
                { label: "LIS门诊采血生成", value: "1" },
                { label: "病区护士站生成", value: "3" },
                { label: "住院医生站生成", value: "4" },
                { label: "标本拆分之后的标本", value: "5" },
                { label: "为院感系统生产", value: "6" },
                { label: "输入病历号开窗选取项目后生成", value: "21" },
                { label: "Lis系统登记生成", value: "22" },
                { label: "通过检验中心登记", value: "23" },
                { label: "外院标本", value: "24" },
                { label: "POCT生成的申请单", value: "25" },
                { label: "报告处理界面录入的申请", value: "26" },
                { label: "住院医生站输血申请", value: "41" },
                { label: "输血申请附带的检验申请", value: "42" },
            ],
            pickerOptions: {
                //添加跳转今天
                shortcuts: [
                    {
                        text: "今天",
                        onClick(picker) {
                            picker.$emit("pick", new Date());
                            _that.sample_startdt = new Date();
                            _that.sample_enddt = new Date();
                        },
                    },
                ],
            },
            image: "",
            checkflag: 1,
            // 导出修改
            bExportSettingsVisible: false, //导出设置弹窗
            exportFileTitle: "@sampledate_@sampleno_@rptunitid_@pat_no_@pat_name",
            exampleTitle: "@sampledate_@sampleno_@rptunitid_@pat_no_@pat_name",
            nalist: [], //导出名称重复添加文件重复序号
            logList: [],
            exportIndex: 0,
            dialogVisible: false,
            dialogSelPatVisible: false,
            printmsg: "",
            selectall: false, //全选  用于打印/导出的全选
            howdays: 1, //查询几天内的报告 
            PushToFlag: true, // 双击标本号跳转对应报告单元确认消息是否已经弹出过标志
            reportcommDlg: false, //添加报告备注弹窗
            multipleflag: "0",
            isSearch: "0",
            sel_reportids: "",
            jsonObj: [
                { text: "条码号", groupName: "医院信息", returnParm: "sel_barcode", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "病历号", groupName: "病人信息", returnParm: "sel_patno", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "", groupName: "病人信息", returnParm: "sel_mh_patno", val: "", component: "el-checkbox", pops: { style: "width: 200px" }, checkboxText: "病历号模糊查询" },
                { text: "姓名", groupName: "病人信息", returnParm: "sel_patname", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "病人床号", groupName: "病人信息", returnParm: "sel_reqbedno", val: "", component: "el-input", pops: { style: "width: 200px" } },
                // { text: "样本号", groupName: "医院信息", returnParm: "sel_sampleno", component: "el-input", pops: { style: "width: 200px", placeholder: "输入如1,2,5-8等格式" } },
                { text: "病人卡号", groupName: "病人信息", returnParm: "sel_patcardno", val: "", component: "el-input", pops: { style: "width: 200px" } },
                {
                    text: "自动审核",
                    groupName: "医院信息",
                    returnParm: "sel_chkflag",
                    val: "",
                    component: "el-select",
                    pops: { style: "width: 200px" },
                    selectOptions: [
                        { label: "全部", value: "all" },
                        { label: "待审核", value: "0" },
                        { label: "审核通过", value: "1" },
                        { label: "审核不通过", value: "2" },
                        { label: "不参与审核", value: "9" },
                    ],
                },
                { text: "送检医院", groupName: "医院信息", returnParm: "sel_hospitalcode", val: "", component: "rm-ddl-common", pops: { datatype: "hospital", dataname: "医院" } },
                {
                    text: "审核状态",
                    groupName: "报告信息",
                    returnParm: "sel_ischeck",
                    val: "",
                    component: "el-select",
                    pops: { style: "width: 200px" },
                    selectOptions: [
                        { label: "全部", value: "all" },
                        { label: "未审核", value: "0" },
                        { label: "已审核", value: "1" },
                    ],
                },
                { text: "报告项目", groupName: "报告信息", returnParm: "sel_rptitemcode", val: "", component: "rm-ddl-rptitem", pops: { style: "width: 200px", prgno: "LIS410", isAllRpt: "1" } },
                { text: "数值结果>", groupName: "报告信息", returnParm: "sel_resultnum1", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "数值结果<", groupName: "报告信息", returnParm: "sel_resultnum2", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "申请科室", groupName: "医院信息", returnParm: "sel_reqdeptno", val: "", component: "rm-ddl-common", pops: { datatype: "dept", dataname: "科室" } },
                { text: "申请医生", groupName: "医院信息", returnParm: "sel_reqdocno", val: "", component: "rm-ddl-common", pops: { datatype: "doctor", dataname: "送检医生" } },
                {
                    text: "标本状态",
                    groupName: "报告信息",
                    returnParm: "sel_specimencomm",
                    val: "",
                    component: "el-select",
                    pops: { style: "width: 200px", placeholder: "请选择" },
                    selectOptions: [
                        { label: "全部", value: "all" },
                        { label: "无标记", value: "0" },
                        { label: "有标记", value: "1" },
                    ],
                },
                { text: "采样医生", groupName: "医院信息", returnParm: "sel_sampleduser", val: "", component: "rm-ddl-common", pops: { datatype: "userinfo", dataname: "用户" } },
                { text: "送检目的", groupName: "医院信息", returnParm: "sel_reqreason", val: "", component: "el-input", pops: { style: "width: 200px" } },
                {
                    text: "结果标志",
                    groupName: "报告信息",
                    returnParm: "sel_rflag",
                    val: "",
                    component: "el-select",
                    pops: { placeholder: "请选择", style: "width: 200px" },
                    selectOptions: [
                        { label: "全部", value: "all" },
                        { label: "偏高", value: "H" },
                        { label: "偏低", value: "L" },
                        { label: "阳性", value: "P" },
                        { label: "弱阳性", value: "Q" },
                        { label: "正常", value: "1" },
                    ],
                },
                { text: "标本类型", groupName: "报告信息", returnParm: "sel_specimencode", val: "", component: "rm-ddl-common", pops: { ref: "ddlspecimen", datatype: "specimen", dataname: "标本类型" } },
                { text: "收费类别", groupName: "医院信息", returnParm: "sel_chargetypeno", val: "", component: "rm-ddl-common", pops: { datatype: "chargetype", dataname: "收费类别" } },
                { text: "临床诊断", groupName: "医院信息", returnParm: "sel_patdiag", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "文字描述1", groupName: "医院信息", returnParm: "sel_txtinfo1", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "文字描述2", groupName: "医院信息", returnParm: "sel_txtinfo2", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "检验医生", groupName: "医院信息", returnParm: "sel_reportuser", val: "", component: "rm-ddl-common", pops: { datatype: "userinfo", dataname: "用户" } },
                { text: "所属病区", groupName: "病人信息", returnParm: "sel_reqwardno", val: "", component: "rm-ddl-common", pops: { datatype: "ward", dataname: "病区" } },
                { text: "病人所属医院", groupName: "病人信息", returnParm: "sel_pat_hospcode", val: "", component: "rm-ddl-common", pops: { datatype: "hospital", dataname: "医院" } },
                {
                    text: "急诊标志",
                    groupName: "报告信息",
                    returnParm: "sel_emerflag",
                    val: "",
                    component: "el-select",
                    pops: { placeholder: "请选择", style: "width: 200px" },
                    selectOptions: [
                        { label: "全部", value: "all" },
                        { label: "常规", value: "0" },
                        { label: "加急", value: "1" },
                    ],
                },
                { text: "身份证号", groupName: "病人信息", returnParm: "sel_pat_idcardno", val: "", component: "el-input", pops: { style: "width: 200px" } },
                { text: "审核医生", groupName: "医院信息", returnParm: "sel_rechkuser", val: "", component: "rm-ddl-common", pops: { datatype: "userinfo", dataname: "用户" } },
                { text: "病区组", groupName: "医院信息", returnParm: "sel_combno", val: "", component: "rm-ddl-common", pops: { datatype: "wardcomb", dataname: "病区" } },
                { text: "耐药机制", groupName: "医院信息", dblclickparm: "sel_result4", returnParm: "sel_result4", val: "", component: "el-select", pops: { style: "width: 200px", placeholder: "请选择", clearable: true, filterable: true }, selectOptions: [] },
                {
                    text: "打印状态",
                    groupName: "报告信息",
                    returnParm: "sel_isprint",
                    val: "",
                    component: "el-select",
                    pops: { style: "width: 200px" },
                    selectOptions: [
                        { label: "全部", value: "all" },
                        { label: "未打印", value: "0" },
                        { label: "已打印", value: "1" },
                    ],
                },
                { text: "报告单元", groupName: "报告信息", returnParm: "sel_rptunit", val: "", component: "rm-ddl-rptunit", pops: { style: "width: 200px", clearable: true, prgno: "" } },
                { text: "报告项目组合", groupName: "报告信息", returnParm: "sel_itemcombid", val: "", component: "rm-ddl-common", pops: { datatype: "reportitemcomb", dataname: "项目组合" } },
                {
                    text: "混样报告",
                    groupName: "报告信息",
                    returnParm: "sel_mixrpt",
                    val: "",
                    component: "el-select",
                    pops: { style: "width: 200px", placeholder: "请选择" },
                    selectOptions: [
                        { label: "全部报告", value: "all" },
                        { label: "未打印", value: "0" },
                        { label: "混样主报告和非混样报告", value: "1" },
                        { label: "混样明细报告和非混样报告", value: "2" },
                        { label: "非混样报告", value: "3" },
                        { label: "混样报告", value: "4" },
                        { label: "仅混样主报告", value: "5" },
                        { label: "仅混样明细报告", value: "6" },
                    ],
                },
                { text: "", groupName: "其余选项", returnParm: "sel_outsex", val: "", component: "el-checkbox", pops: { style: "width: 200px" }, checkboxText: "剔除无性别" },
                { text: "", groupName: "其余选项", returnParm: "sel_markno", val: "", component: "el-checkbox", pops: { style: "width: 200px" }, checkboxText: "仅标记的报告" },
                { text: "", groupName: "其余选项", returnParm: "sel_onlyouthospital", val: "", component: "el-checkbox", pops: { style: "width: 200px" }, checkboxText: "仅查询外院" },
                { text: "", groupName: "其余选项", returnParm: "sel_onlymed", val: "", component: "el-checkbox", pops: { style: "width: 200px" }, checkboxText: "仅显示细菌阳性结果" },
            ],
            datename: "标本日期",
            daytype: "1",
            sel_mergePdf: 0,
            serachpatidcard: "",
            pat_idcardnoen: "",
            pat_idcardno: "",
            sTags: [],
            showTags: [],
            tagShowNum: 5,
            setTagCss: {
                width: "110px",
                "margin-right": "5px",
                cursor: "pointer",
                "user-select": "none",
                "border-radius": "3px",
            },
            oldWidth: 0,
            tagCurrPage: 1,
            tagMaxPage: 0,
            disTagLeft: false,
            disTagRight: false,
            txtinfo1: "",
            txtinfo2: "",
            marrowshowmode: "3",
            showresult3: "0",
        };
    },
    created() {
        this.initOption();
        this.initDate();
        this.BtnClear(1);
        this.setTagShowNum();
    },
    watch: {},
    mounted() {
        //定义快捷键F8
        var _this = this;
        document.onkeydown = function (e) {
            let key = window.event.keyCode;
            switch (key) {
                case 119: //查询F8
                    _this.BtnchkQuery();
                    break;
            }
        };
        //页面加载完就要焦点聚焦了
        // this.$refs.refQuicklyQ.focus();
    },
    updated() {},
    methods: {
        handleCommand(name) {
            this.datename = name;
            if (name == "标本日期") {
                this.daytype = "1";
            } else if (name == "审核日期") {
                this.daytype = "2";
            }
        },
        handlePageChange({ currentPage, pageSize }) {
            this.tablePage.currentPage = currentPage;
            this.tablePage.pageSize = pageSize;
            this.BtnQuery(0);
        },
        async queryRpt(rptunitid, reportid) {
            try {
                //针对权限问题修复组件查询url
                const res = await this.$tool.request({
                    url: "LIS/LIS4/LIS410",
                    method: "post",
                    data: {
                        action: "reportview",
                        rptunitid: rptunitid,
                        reportid: reportid,
                    },
                });
                if (res) {
                    this.bShowRpt = res.bshowrpt;
                    this.rptviewkey++;
                    if (res.bshowrpt) {
                        this.rptData = res.rptlist;
                        this.rptData.forEach((e) => {
                            e.validflagname = e.validflag == "1" ? "有效" : "无效";
                        });
                    } else this.rptData = [];
                } else this.rptData = [];
            } catch (e) {
                this.$message.warning(e);
            }
        },
        ChangeQ() {
            //收缩和展开也添加焦点聚焦快捷查询，变更名称
            this.$refs.refQuicklyQ.focus();
            if (this.sel_patname_mh == "1") {
                this.Qna = "姓名查询";
                this.currholder = "姓名 (去除勾选姓名模糊，可恢复快捷查询)";
            } else {
                this.Qna = "快捷查询";
                this.currholder = "病人号,病人ID,卡号,姓名,条码号,报告ID,身份证";
            }
        },
        popMultipleChk(e, fieldname, option, title) {
            let temp = XE.clone(option, true);
            this.option1 = [];
            this.option2 = [];
            if (e != "") {
                let k = e.split(",");
                k.forEach((item) => {
                    let ndata = temp.find((m) => m.data == item);
                    if (ndata != undefined && ndata != null) {
                        this.option2.push(ndata);
                    }
                });
                temp.forEach((item) => {
                    if (k.indexOf(item.data + "") < 0) {
                        this.option1.push(item);
                    }
                });
            } else {
                this.option1 = temp;
            }
            this.fieldname = fieldname;
            this.dlgTitle = title;
            this.dialogMultipleVisible = true;
        },
        closedialog(value, name) {
            if (value != "close") {
                this[name] = value;
            }
            this.dialogMultipleVisible = false;
            //把返回结果传回高级查询组件
            this.$refs.rm_AdvancedSearch.postDialogData("sel_result4", value);
        },
        async initOption() {
            if (typeof jsObj != "undefined") {
                var computeInfo = jsObj.GetComputeInfo();
                var arr = computeInfo.split("\r");
                if (arr.length == 3) {
                    this.macaddress = arr[0];
                }
            } else {
                this.macaddress = "Default";
            }
            try {
                //针对权限问题修复组件查询url
                const res = await this.$tool.request({
                    url: "LIS/LIS4/LIS410",
                    method: "post",
                    data: {
                        action: "initoption",
                    },
                });

                this.pattypeOption = res.pattypeOption;
                this.rescodeOption = res.rescodeOption;
                var options = [];
                if (res.rescodeOption.length > 0) {
                    res.rescodeOption.forEach((element) => {
                        options.push({ label: element.display, value: element.data });
                    });
                }
                this.jsonObj[30].selectOptions = options;
                this.rptunitAll = res.rptunitAll;
                if (res.defrptunitid != 0) {
                    this.sel_rptunit = res.defrptunitid.toString();
                }
                if (res.secHospCodeOption && res.secHospCodeOption != "") {
                    //把返回结果传回高级查询组件
                    this.$refs.rm_AdvancedSearch.setSerchData("sel_pat_hospcode", res.secHospCodeOption);
                }
            } catch (e) {
                this.$message.warning(e);
            }
        },
        //取设置默认时间
        async initDate() {
            try {
                const res = await this.$tool.request({
                    url: "LIS/LIS4/LIS410",
                    method: "post",
                    data: {
                        action: "initDate",
                    },
                });
                if (res) {
                    this.sel_quick_query_patno = res.changequickqueryseting;
                    this.howdays = XE.toInteger(res.howdays);
                    if (this.howdays >= 1) {
                        this.sample_startdt = this.$pub.InitDateTime2(this.howdays - 1).datefrom;
                    }
                }
            } catch (e) {
                this.$message.warning(e);
            }
        },
        openDialog(parm) {
            switch (parm) {
                case "sel_result4":
                    this.popMultipleChk(this.sel_result4, "sel_result4", this.rescodeOption, "耐药机制选择");
                    break;
            }
        },
        setTagShowNum() {
            //1920*1080分辨率，140+1066+687+28=1920，1065为实际宽度
            //1680*1050分辨率，140+831+681+28=1680，831为实际宽度
            //1600*1050分辨率，140+751+681+28=1600，751为实际宽度
            var w = document.body.offsetWidth - 140 - 28 - 687 - 50;
            this.tagShowNum = Math.floor(w / 115); //向下取整数
            if (document.body.offsetWidth < 1600 && document.body.offsetWidth >= 1400) {
                this.setTagCss = {
                    width: "100px",
                    "margin-right": "5px",
                    cursor: "pointer",
                    "user-select": "none",
                    "border-radius": "3px",
                };
                this.tagShowNum = Math.floor(w / 105); //向下取整数
            }
            if (document.body.offsetWidth < 1400) {
                this.setTagCss = {
                    width: "85px",
                    "margin-right": "5px",
                    cursor: "pointer",
                    "user-select": "none",
                    "border-radius": "3px",
                };
                this.tagShowNum = Math.floor(w / 90); //向下取整数
            }
            this.oldWidth = document.body.offsetWidth;
        },
        showAdvancedTags(searchTags) {
            this.tagCurrPage = 1;
            this.tagMaxPage = Math.ceil(searchTags.length / this.tagShowNum);
            this.disTagLeft = false;
            this.disTagRight = true;
            this.sTags = XE.clone(searchTags, true);
            if (!!this.sTags && this.sTags.length > this.tagShowNum) {
                this.showTags = [];
                for (var i = 0; i < this.tagShowNum; i++) {
                    this.showTags.push(this.sTags[i]);
                }
            } else {
                this.showTags = XE.clone(this.sTags, true);
            }
        },
        tagClose(tag) {
            this.sTags.splice(this.sTags.indexOf(tag), 1);
            this.showTags.splice(this.showTags.indexOf(tag), 1); //展示出来的tag数组
            if (this.showTags.length == 0 && this.sTags.length > 0) {
                //当前页是最后一页，且本次删掉之后，总的tag还有，但当前页已经没了，重新加载
                this.showAdvancedTags(this.sTags);
            } else if (this.tagCurrPage < this.tagMaxPage) {
                //后面的数据填充进现在的数据
                var index = this.tagCurrPage * this.tagShowNum - 1;
                this.showTags.push(this.sTags[index]);
                //判断后面是否还有数据，对右侧按钮进行禁用
                if (Math.ceil(this.sTags.length / this.tagShowNum) == this.tagCurrPage) {
                    this.disTagRight = false;
                }
                //重新计算最大页数
                this.tagMaxPage = Math.ceil(this.sTags.length / this.tagShowNum);
            }
            if (tag.refname == "sidcard") {
                //清除身份证信息
                this.serachpatidcard = "";
                this.pat_idcardnoen = "";
                this.pat_idcardno = "";
            } else {
                //清除高级查询内的查询条件
                this.$refs.rm_AdvancedSearch.cleaSelData(tag);
            }
        },
        leftTag() {
            if (!this.disTagLeft) {
                return false;
            }
            this.disTagLeft = false; //防止多次点击，先禁掉
            let befoPage = this.tagCurrPage - 1;
            var c = this.tagCurrPage * this.tagShowNum;
            var b = befoPage * this.tagShowNum;
            this.tagCurrPage = befoPage;
            this.showTags = [];

            for (var i = b - this.tagShowNum; i < b; i++) {
                this.showTags.push(this.sTags[i]);
            }

            if (this.tagCurrPage > 1) {
                this.disTagLeft = true;
            }
            this.disTagRight = true; //把右边的按钮打开
        },
        rightTag() {
            if (!this.disTagRight) {
                return false;
            }
            this.disTagRight = false; //防止多次点击，先禁掉
            let nextPage = this.tagCurrPage + 1;
            var c = this.tagCurrPage * this.tagShowNum;
            var n = nextPage * this.tagShowNum;
            this.tagCurrPage = nextPage;
            this.showTags = [];

            if (this.sTags.length > n) {
                for (var i = c; i < n; i++) {
                    this.showTags.push(this.sTags[i]);
                }
            } else {
                for (var i = c; i < this.sTags.length; i++) {
                    this.showTags.push(this.sTags[i]);
                }
            }
            if (nextPage < this.tagMaxPage) {
                this.disTagRight = true;
            }
            this.disTagLeft = true; //把左边的按钮打开
        },
        BtnchkQuery() {
            this.HightlightPos(this.quicklyQ);
            //添加查询翻页
            this.tablePage.currentPage = 1;
            // 添加大于5天，对只修改查询日期的查询弹窗提示。
            var tmpdiff = XE.getDateDiff(this.sample_startdt, this.sample_enddt);
            if (tmpdiff.done && (tmpdiff.yyyy > 0 || tmpdiff.MM > 0 || tmpdiff.dd > 4)) {
                var AdvancedSearch = this.$refs.rm_AdvancedSearch.getSerchData();
                if (
                    AdvancedSearch.sel_rptunit == "" &&
                    this.quicklyQ == "" &&
                    this.sel_rptunit == "" &&
                    this.sel_rptunitlist == "" &&
                    AdvancedSearch.sel_patno == "" &&
                    AdvancedSearch.sel_patcardno == "" &&
                    AdvancedSearch.sel_reqbedno == "" &&
                    this.sel_reportcomm == "" &&
                    AdvancedSearch.sel_reqreason == "" &&
                    AdvancedSearch.sel_result4 == "" &&
                    AdvancedSearch.sel_patname == "" &&
                    this.sel_patname_mh == "0" &&
                    this.sel_pattypecode == "" &&
                    AdvancedSearch.sel_specimencode == "" &&
                    this.sel_sampleno == "" &&
                    AdvancedSearch.sel_emerflag == "all" &&
                    AdvancedSearch.sel_reqdeptno == "" &&
                    AdvancedSearch.sel_chargetypeno == "" &&
                    AdvancedSearch.sel_chkflag == "all" &&
                    AdvancedSearch.sel_mixrpt == "0" &&
                    AdvancedSearch.sel_rflag == "all" &&
                    AdvancedSearch.sel_rptitemcode == "" &&
                    AdvancedSearch.sel_resultnum1 == "" &&
                    AdvancedSearch.sel_resultnum2 == "" &&
                    AdvancedSearch.sel_barcode == "" &&
                    AdvancedSearch.sel_reqdocno == "" &&
                    AdvancedSearch.sel_specimencomm == "all" &&
                    AdvancedSearch.sel_sampleduser == "" &&
                    AdvancedSearch.sel_patdiag == "" &&
                    AdvancedSearch.sel_reportuser == "" &&
                    AdvancedSearch.sel_reqwardno == "" &&
                    AdvancedSearch.sel_itemcombid == "" &&
                    this.sel_allprint == false &&
                    AdvancedSearch.sel_isprint == "all" &&
                    AdvancedSearch.sel_ischeck == "all" &&
                    AdvancedSearch.sel_pat_idcardno == "" &&
                    AdvancedSearch.sel_rechkuser == "" &&
                    AdvancedSearch.sel_combno == "" &&
                    AdvancedSearch.sel_outsex == false &&
                    AdvancedSearch.sel_onlymed == false &&
                    AdvancedSearch.sel_markno == false &&
                    AdvancedSearch.sel_txtinfo1 == "" &&
                    AdvancedSearch.sel_txtinfo2 == "" &&
                    AdvancedSearch.sel_hospitalcode == "" &&
                    AdvancedSearch.sel_pat_hospcode == "" &&
                    AdvancedSearch.sel_onlyouthospital == false
                ) {
                    this.$confirm("当前查询区间大于5天，且未选择其余查询条件，您确定要继续查询吗？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            if (this.sel_quick_query_patno == "1" && this.sel_patname_mh != "1" && !!this.quicklyQ) {
                                this.CheckQueryPeople();
                            } else {
                                this.BtnQuery(0);
                            }
                        })
                        .catch(() => {});
                } else {
                    if (this.sel_quick_query_patno == "1" && this.sel_patname_mh != "1" && !!this.quicklyQ) {
                        this.CheckQueryPeople();
                    } else {
                        this.BtnQuery(0);
                    }
                }
            } else {
                if (this.sel_quick_query_patno == "1" && this.sel_patname_mh != "1" && !!this.quicklyQ) {
                    this.CheckQueryPeople();
                } else {
                    this.BtnQuery(0);
                }
            }
        },
        BtnIDCardQuery() {
            //身份证号查询时把其他条件清空，以免影响身份证号查询
            this.BtnClear(3);
            let row = this.$refs.reportTable.getCurrentRow();
            if (row) {
                if (row.pat_idcardnoen || row.pat_idcardno) {
                    this.serachpatidcard = row.pat_idcardno;
                    this.pat_idcardnoen = row.pat_idcardnoen;
                    this.pat_idcardno = row.pat_idcardno;

                    var st_index = -1;
                    if (!!this.sTags) {
                        st_index = this.sTags.findIndex((item) => {
                            return item.refname == "sidcard";
                        });
                    }
                    var wordageLimit = 6;
                    if (document.body.offsetWidth < 1600 && document.body.offsetWidth >= 1400) {
                        wordageLimit = 5;
                    }
                    if (document.body.offsetWidth < 1400) {
                        wordageLimit = 4;
                    }
                    wordageLimit = wordageLimit * 1.8;
                    var displaytxt = row.pat_idcardno;
                    if (st_index == -1) {
                        //插入Tag
                        if (displaytxt.length > wordageLimit) {
                            displaytxt = displaytxt.substring(0, wordageLimit) + "...";
                        }
                        let tmp = {
                            displaytxt: displaytxt,
                            title: "身份证号" + "：" + row.pat_idcardno,
                            tdname: "身份证号",
                            code: row.pat_idcardno,
                            name: "",
                            refname: "sidcard",
                            type: "sidcard",
                        };
                        this.sTags.push(tmp);
                    } else {
                        if (displaytxt.length > wordageLimit) {
                            displaytxt = displaytxt.substring(0, wordageLimit) + "...";
                        }
                        this.sTags[st_index].code = row.pat_idcardno;
                        this.sTags[st_index].displaytxt = displaytxt;
                        this.sTags[st_index].title = "身份证号" + "：" + row.pat_idcardno;
                    }
                    this.showAdvancedTags(this.sTags);
                    this.BtnQuery(1);
                } else {
                    this.serachpatidcard = "";
                    this.$message.warning("该报告无病人身份证信息，无法进行身份证号查询！");
                }
            } else {
                this.serachpatidcard = "";
                this.$message.warning("请您先选择一条报告单数据！");
                return false;
            }
        },
        HightlightPos(myValue) {
            if (myValue == "") {
                return false;
            }
            var myField = document.getElementById("refQuicklyQ");
            if (myField.selectionStart || myField.selectionStart === 0) {
                var startPos = myField.selectionStart;
                var endPos = myField.selectionEnd;
                this.$nextTick(() => {
                    myField.selectionStart = 0;
                    myField.selectionEnd = startPos + myValue.length;
                }); // 这句是重点, 圈起来
                myField.focus();
                myField.setSelectionRange(myField, myField.selectionStart, myField.selectionEnd);
            }
        },
        //
        QueryImagePDF(reportid) {
            if (reportid) {
                this.$tool
                    .request({
                        url: "/ucent/downloadfile",
                        method: "post",
                        responseType: "blob",
                        data: {
                            prgno: "LIS312",
                            reportid: reportid,
                        },
                    })
                    .then((res) => {
                        let blob = new Blob([res], {
                            type: "application/pdf",
                        });
                        let objectUrl = window.URL.createObjectURL(blob);
                        this.image = objectUrl;
                    });
            } else {
                this.image = "";
            }
        },
        checkPeopleDblClickEvent({ row, column }) {
            this.sel_reportids = row.reportids;
            this.isSearch = "1";
            //调用搜索，关闭弹窗
            this.BtnQuery(0);
            this.dialogSelPatVisible = false;
        },
        checkPeopleClickEvent() {
            var rows = this.$refs.tablepeople.getSelectRecords();
            if (rows.length > 0) {
                this.sel_reportids = "";
                rows.forEach((element) => {
                    if (!!element.reportids) {
                        this.sel_reportids += element.reportids + ",";
                    }
                });
                //调用搜索，关闭弹窗
                this.isSearch = "1";
                this.BtnQuery(0);
                this.dialogSelPatVisible = false;
            } else {
                this.$message({
                    type: "warning",
                    message: "请先选择需要查询的病人信息",
                });
            }
        },
        CheckQueryPeople() {
            this.report_Loading = true;
            this.selectall = false; //用于重置全选
            this.printReportid = "";
            this.rechkflag = "";
            this.unprint_flag = "";
            this.exportna = "";
            //添加前台查询超时提示
            var timptips = setTimeout(() => {
                this.report_Loading = false;
                this.$message({
                    type: "warning",
                    message: "查询失败：查询超时，本次查询已超过最大等待时间600秒。",
                });
            }, 600000);
            var AdvancedSearch = this.$refs.rm_AdvancedSearch.getSerchData();
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS410",
                    method: "post",
                    timeout: 600000,
                    data: {
                        action: "report_people_query",
                        isSearch: this.isSearch,
                        sel_reportids: this.sel_reportids,
                        quicklyQ: this.quicklyQ,
                        sample_startdt: this.sample_startdt,
                        sample_enddt: this.sample_enddt,
                        sel_rptunit: AdvancedSearch.sel_rptunit,
                        sel_rptunitlist: this.sel_rptunitlist,
                        sel_patno: AdvancedSearch.sel_patno,
                        sel_patcardno: AdvancedSearch.sel_patcardno,
                        sel_reqbedno: AdvancedSearch.sel_reqbedno,
                        sel_reportcomm: this.sel_reportcomm,
                        sel_reqreason: AdvancedSearch.sel_reqreason,
                        sel_result4: AdvancedSearch.sel_result4,
                        sel_patname: AdvancedSearch.sel_patname,
                        sel_patname_mh: this.sel_patname_mh,
                        sel_pattypecode: this.sel_pattypecode,
                        sel_specimencode: AdvancedSearch.sel_specimencode,
                        sel_sampleno: this.sel_sampleno,
                        sel_emerflag: AdvancedSearch.sel_emerflag,
                        sel_reqdeptno: AdvancedSearch.sel_reqdeptno,
                        sel_chargetypeno: AdvancedSearch.sel_chargetypeno,
                        sel_chkflag: AdvancedSearch.sel_chkflag,
                        sel_mixrpt: AdvancedSearch.sel_mixrpt,
                        sel_rflag: AdvancedSearch.sel_rflag,
                        sel_rptitemcode: AdvancedSearch.sel_rptitemcode,
                        sel_resultnum1: AdvancedSearch.sel_resultnum1,
                        sel_resultnum2: AdvancedSearch.sel_resultnum2,
                        sel_barcode: AdvancedSearch.sel_barcode,
                        sel_reqdocno: AdvancedSearch.sel_reqdocno,
                        sel_specimencomm: AdvancedSearch.sel_specimencomm,
                        sel_sampleduser: AdvancedSearch.sel_sampleduser,
                        sel_patdiag: AdvancedSearch.sel_patdiag,
                        sel_reportuser: AdvancedSearch.sel_reportuser,
                        sel_reqwardno: AdvancedSearch.sel_reqwardno,
                        sel_itemcombid: AdvancedSearch.sel_itemcombid,
                        sel_allprint: this.sel_allprint ? "1" : "0",
                        sel_isprint: AdvancedSearch.sel_isprint,
                        sel_ischeck: AdvancedSearch.sel_ischeck,
                        sel_pat_idcardno: AdvancedSearch.sel_pat_idcardno,
                        sel_rechkuser: AdvancedSearch.sel_rechkuser,
                        sel_combno: AdvancedSearch.sel_combno,
                        sel_outsex: AdvancedSearch.sel_outsex ? "1" : "0",
                        sel_mh_patno: AdvancedSearch.sel_mh_patno ? "1" : "0",
                        sel_onlyouthospital: AdvancedSearch.sel_onlyouthospital ? "1" : "0",
                        sel_onlymed: AdvancedSearch.sel_onlymed ? "1" : "0",
                        sel_markno: AdvancedSearch.sel_markno ? "1" : "0",
                        sel_txtinfo1: AdvancedSearch.sel_txtinfo1,
                        sel_txtinfo2: AdvancedSearch.sel_txtinfo2,
                        sel_hospitalcode: AdvancedSearch.sel_hospitalcode,
                        sel_pat_hospcode: AdvancedSearch.sel_pat_hospcode,
                        pagesize: this.tablePage.pageSize,
                        currentpage: this.tablePage.currentPage,
                    },
                })
                .then((res) => {
                    clearTimeout(timptips);
                    // 添加后台日志查询返回
                    if (res.msg != "") {
                        this.$message({
                            type: "error",
                            message: res.msg,
                        });
                        this.report_Loading = false;
                        return false;
                    }
                    if (res.multipleflag == "1") {
                        //搜索结果存在多个病人，需要弹窗进行选择
                        this.multipleflag = "1";
                        this.checkPeople_data = [];
                        this.checkPeople_data = res.RData.Data;
                        this.report_Loading = false;
                        //弹窗，双击选择病人
                        this.dialogSelPatVisible = true;
                    } else {
                        //搜索结果只有一个病人，执行搜索
                        this.BtnQuery(0);
                    }
                })
                .catch((e) => {
                    this.$message.error(e);
                });
        },
        BtnQuery(type) {
            //0为普通查询，1为身份证号查询
            if (type == 0) this.serachpatidcard = "";
            this.report_Loading = true;
            this.selectall = false; //用于重置全选
            this.printReportid = "";
            this.rechkflag = "";
            this.unprint_flag = "";
            this.exportna = "";
            //添加前台查询超时提示
            var timptips = setTimeout(() => {
                this.report_Loading = false;
                this.$message({
                    type: "warning",
                    message: "查询失败：查询超时，本次查询已超过最大等待时间600秒。",
                });
            }, 600000);
            var AdvancedSearch = this.$refs.rm_AdvancedSearch.getSerchData();
            // console.log(AdvancedSearch);
            var temp_sel_patno = AdvancedSearch.sel_patno;
            var temp_sel_patname = AdvancedSearch.sel_patname;
            if (this.multipleflag == "1") {
                //若该变量为1，则以当前所选择的病人为准
                temp_sel_patno = this.sel_patno;
                temp_sel_patname = this.sel_patname;
            }
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS410",
                    method: "post",
                    timeout: 600000,
                    data: {
                        action: "lab_report_query",
                        isSearch: this.isSearch,
                        sel_reportids: this.sel_reportids,
                        quicklyQ: this.quicklyQ,
                        daytype: this.daytype, //标本日期(1) 审核日期(2)
                        sample_startdt: this.sample_startdt,
                        sample_enddt: this.sample_enddt,
                        sel_rptunit: AdvancedSearch.sel_rptunit,
                        sel_rptunitlist: this.sel_rptunitlist,
                        sel_patno: temp_sel_patno,
                        sel_patcardno: AdvancedSearch.sel_patcardno,
                        sel_reqbedno: AdvancedSearch.sel_reqbedno,
                        sel_reportcomm: this.sel_reportcomm,
                        sel_reqreason: AdvancedSearch.sel_reqreason,
                        sel_result4: AdvancedSearch.sel_result4,
                        sel_patname: temp_sel_patname,
                        sel_patname_mh: this.sel_patname_mh,
                        sel_pattypecode: this.sel_pattypecode,
                        sel_specimencode: AdvancedSearch.sel_specimencode,
                        sel_sampleno: this.sel_sampleno,
                        sel_emerflag: AdvancedSearch.sel_emerflag,
                        sel_reqdeptno: AdvancedSearch.sel_reqdeptno,
                        sel_chargetypeno: AdvancedSearch.sel_chargetypeno,
                        sel_chkflag: AdvancedSearch.sel_chkflag,
                        sel_mixrpt: AdvancedSearch.sel_mixrpt,
                        sel_rflag: AdvancedSearch.sel_rflag,
                        sel_rptitemcode: AdvancedSearch.sel_rptitemcode,
                        sel_resultnum1: AdvancedSearch.sel_resultnum1,
                        sel_resultnum2: AdvancedSearch.sel_resultnum2,
                        sel_barcode: AdvancedSearch.sel_barcode,
                        sel_reqdocno: AdvancedSearch.sel_reqdocno,
                        sel_specimencomm: AdvancedSearch.sel_specimencomm,
                        sel_sampleduser: AdvancedSearch.sel_sampleduser,
                        sel_patdiag: AdvancedSearch.sel_patdiag,
                        sel_reportuser: AdvancedSearch.sel_reportuser,
                        sel_reqwardno: AdvancedSearch.sel_reqwardno,
                        sel_itemcombid: AdvancedSearch.sel_itemcombid,
                        sel_allprint: this.sel_allprint ? "1" : "0",
                        sel_isprint: AdvancedSearch.sel_isprint,
                        sel_ischeck: AdvancedSearch.sel_ischeck,
                        sel_pat_idcardno: AdvancedSearch.sel_pat_idcardno,
                        pat_idcardnoen: this.pat_idcardnoen, //加密后的身份证号，仅身份证号查询使用
                        pat_idcardno: this.pat_idcardno, //身份证号，仅身份证号查询使用
                        sel_rechkuser: AdvancedSearch.sel_rechkuser,
                        sel_combno: AdvancedSearch.sel_combno,
                        sel_outsex: AdvancedSearch.sel_outsex ? "1" : "0",
                        sel_mh_patno: AdvancedSearch.sel_mh_patno ? "1" : "0",
                        sel_onlyouthospital: AdvancedSearch.sel_onlyouthospital ? "1" : "0",
                        sel_onlymed: AdvancedSearch.sel_onlymed ? "1" : "0",
                        sel_markno: AdvancedSearch.sel_markno ? "1" : "0",
                        sel_txtinfo1: AdvancedSearch.sel_txtinfo1,
                        sel_txtinfo2: AdvancedSearch.sel_txtinfo2,
                        sel_hospitalcode: AdvancedSearch.sel_hospitalcode,
                        sel_pat_hospcode: AdvancedSearch.sel_pat_hospcode,
                        isidcardsearch: type == 1 ? "1" : "0",
                        pagesize: this.tablePage.pageSize,
                        currentpage: this.tablePage.currentPage,
                    },
                })
                .then((res) => {
                    clearTimeout(timptips);
                    this.multipleflag = "0";
                    this.isSearch = "0";
                    this.sel_reportids = "";
                    //身份证号查询结束后清除，防止影响下一次查询
                    this.pat_idcardnoen = "";
                    this.pat_idcardno = "";

                    this.tablePage.total = res.RData.total;
                    //添加后台日志查询返回
                    if (res.msg != "") {
                        this.$message({
                            type: "error",
                            message: res.msg,
                        });
                        this.report_Loading = false;
                        return false;
                    }
                    this.report_data = res.RData.Data;
                    this.result_data = [];
                    this.report_Loading = false;
                    this.$refs.refQuicklyQ.focus();
                    if (this.report_data.length > 0) {
                        this.$refs.reportTable.setCurrentRow(this.report_data[0]);
                        this.queryResult(this.report_data[0]);
                        // this.queryRpt(this.report_data[0].rptunitid, this.report_data[0].reportid);
                        this.printReportid = this.report_data[0].reportid;
                        this.rechkflag = this.report_data[0].rechkflag;
                        this.unprint_flag = this.report_data[0].unprint_flag;
                        this.exportna = this.report_data[0].reportid + "-" + this.report_data[0].pat_name;
                    }
                })
                .catch((e) => {
                    this.$message.error(e);
                });
        },
        reportchange_Event({ row, rowIndex, column, columnIndex }, event) {
            this.printReportid = row.reportid;
            this.rechkflag = row.rechkflag;
            this.unprint_flag = row.unprint_flag;
            this.exportna = row.reportid + "-" + row.pat_name;
            this.tab_rshowflag = "tab_result";
            this.queryResult(row);
            // this.queryRpt(row.rptunitid, row.reportid);
        },
        resultChange({ row, rowIndex, column, columnIndex }, event) {
            this.queryMedResult(row);
        },
        queryResult(row) {
            this.result_Loading = true;
            this.resusltmed_date = [];
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS410",
                    method: "post",
                    data: {
                        action: "get_labresult",
                        reportid: row.reportid,
                        rptunitid: row.rptunitid,
                        macaddress: this.macaddress,
                    },
                })
                .then((res) => {
                    if (res.rpttype == "2") {
                        //药敏
                        this.rpttype = "2";
                        // this.is_ym = true;
                        this.result_data = res.rtn[0];
                        // this.resusltmed_date = res.rtn[1];
                        this.result_amount = this.result_data.length;
                        this.ymresultitem_amount = this.resusltmed_date.length;
                        if (this.result_amount > 0) {
                            setTimeout(() => {
                                this.$refs.ymresulttable.setCurrentRow(this.result_data[0]);
                                this.queryMedResult(this.result_data[0]);
                            }, 80);
                        }
                    } else if (res.rpttype == "3") {
                        this.rpttype = "3";
                        this.image = "";
                        this.QueryImagePDF(row.reportid);
                    } else if (res.rpttype == "4") {
                        this.rpttype = "4";
                        this.showresult3 = res.showresult3;
                        this.marrowshowmode = res.showmode;
                        this.result_data = res.rtn[0];
                        this.result_amount = this.result_data.length;
                        this.txtinfo1 = row.txtinfo1;
                        this.txtinfo2 = row.txtinfo2;
                    } else {
                        this.rpttype = "1";
                        // this.is_ym = false;
                        this.result_data = res.rtn[0];
                        var resultText = JSON.parse(res.resultText);
                        this.result1text = resultText.result1text;
                        this.result2text = resultText.result2text;
                        this.result3text = resultText.result3text;
                        this.result1 = resultText.result1;
                        this.result2 = resultText.result2;
                        this.result3 = resultText.result3;
                        this.result_amount = this.result_data.length;
                    }
                    this.result_Loading = false;
                })
                .catch((e) => {
                    this.$message.error(e);
                    this.result_Loading = false;
                });
        },
        queryMedResult(row) {
            this.resusltmed_date = [];
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS410",
                    method: "post",
                    data: {
                        action: "get_lab_resultmed",
                        reportid: row.reportid,
                        rpt_itemcode: row.rpt_itemcode,
                        macaddress: this.macaddress,
                    },
                })
                .then((res) => {
                    // console.log("🚸 —— .then —— res", res);
                    this.resusltmed_date = res;
                })
                .catch((e) => {
                    this.$message.error(e);
                });
        },
        tabrightclick_Event(tab, event) {
            if (tab.label == "检验结果") {
            }
            if (tab.label == "报告单预览") {
                this.rptviewkey++;
            }
        },
        tabclick_Event(tab, event) {
            if (tab.label == "报告单") {
                this.show_right = true;
                // this.middle_center.right = "575px"
            }
            if (tab.label == "申请单") {
                this.show_right = false;
                // this.middle_center.right = "0px"
                let row = this.$refs.reportTable.getCurrentRow();
                if (XE.isNull(row)) {
                    this.$message.error("请您先选择一条报告单数据！");
                    return false;
                } else {
                    this.master_Loading = true;
                    //获取申请单数据
                    this.$tool
                        .request({
                            url: "LIS/LIS4/LIS410",
                            method: "post",
                            data: {
                                action: "get_reqmaster",
                                pat_id: row.pat_id,
                            },
                        })
                        .then((res) => {
                            this.master_Loading = false;
                            if (res == "0") {
                                this.master_data = [];
                                this.sum_row = 0;
                                this.sum_amount = 0;
                                this.$message.error("无数据返回，原因:所选数据病人ID为空。");
                            } else {
                                this.master_data = res.data;
                                this.sum_row = this.master_data.length;
                                this.sum_amount = res.sumamount;
                            }
                        })
                        .catch((e) => {
                            this.$message.error(e);
                        });
                }
            }
        },
        //添加查阅病历
        QueryPatcase() {
            if (!this.printReportid) return false;
            this.GetPatcase(this.printReportid);
        },
        GetPatcase(reportid) {
            this.$pub.getPatcase(this, reportid, 3);
        },
        /**
         * 合并导出按钮，有勾选则按照勾选，无勾选则导出选中行
         *  1.添加功能 所有表格所有数据导出
         *                  只导出已审核的报告单
         *                  单次最大导出份数:200
         *
         *  2.参考lis6先做个文件名称可选填的功能
         *              待补充：
         *                   单个XML文件、合并XML文件、XML编码、更新打印日志
         *
         *  3. 文件名称说明:
         *                                          @reportid           = 报告ID
         *                                          @sampledate    = 报告日期
         *                                          @sampleno        = 标本号
         *                                          @barcode           = 条码号
         *                                          @rptunitid          = 报告单元
         *                                          @pat_name       = 病人姓名
         *                                          @pat_no                = 病历号
         *                                          @pat_idcardno = 身份证号护照号
         *                                          @req_reason     = 送检目的
         *          忽略大小写
         */
        BtnExport() {
            this.dlgTitle = "导出文件设置";
            this.logList = [];
            this.bExportSettingsVisible = true; //导出设置弹框
        },
        //导出选中
        BtnRptExport() {
            let exportData = this.report_data.filter((item) => {
                return item.cp_selection == "1";
            });
            if (!(exportData.length > 0)) {
                this.BtnCurrentExport();
            } else {
                this.BtnBatchExport();
            }
        },
        BtnCurrentExport() {
            this.logList = [];
            var COPIES = 0;
            if (this.$refs.reportTable.afterFullData.length <= COPIES) {
                this.logList.push("请先查询出有效数据。");
                return false;
            }
            if (this.printReportid == "") {
                this.logList.push("导出失败：请您先选择一条需导出的报告。");
                return false;
            }
            if (this.rechkflag != "9") {
                this.logList.push("导出失败：当前报告未审核。");
                return false;
            }
            if (this.unprint_flag == "8") {
                this.logList.push("导出失败:当前报告单需要单独授权。");
                return false;
            }
            let currentrow = this.$refs.reportTable.getCurrentRow();
            var reportna = this.transExportName(currentrow) + ".pdf";
            this.$pub.PDFExport(this, this.printReportid, reportna, "LIS410", "1");
            this.logList.push("导出成功。");
        },
        //导出全部
        BtnBatchExport() {
            this.logList = [];
            this.nalist = [];
            let MAXLEN = 200;
            let data = this.report_data.filter((item) => {
                return item.cp_selection == "1";
            });
            let rechkdata = [];
            let exportdata = [];
            if (!data.length > 0) {
                this.logList.push("请先查询出有效数据。");
                return false;
            }
            data.forEach((e) => {
                if (e.rechkflag == "9" && e.unprint_flag != "8") rechkdata.push(e);
            });
            this.logList.push("当前勾选报告数: " + data.length + " 张 ，  已审核数:" + rechkdata.length + " 张");
            this.logList.push("");
            if (!rechkdata.length > 0) {
                this.logList.push("当前无可导出的报告。");
                return false;
            } else {
                // if (rechkdata.length > 200) {
                //     this.logList.push("审核报告数大于最大导出张数:" + MAXLEN + ",导出前" + MAXLEN + "张报告。");
                //     this.logList.push("");
                // }
                // MAXLEN = rechkdata.length > MAXLEN ? MAXLEN : rechkdata.length;
                for (let i = 0; i < rechkdata.length; i++) {
                    exportdata[i] = {
                        reportid: rechkdata[i].reportid,
                        pdfna: this.transExportName(rechkdata[i]) + ".pdf",
                    };
                }
                this.PDFBatchExport(this, exportdata, this.exportFileTitle, "LIS410_batch", "1", 0, "");
            }
        },
        //获取文件名
        //修复reportid的显示问题
        transExportName(detail) {
            let newna = this.exportFileTitle
                .replace(/@reportid/g, detail.reportid == null ? "" : detail.reportid)
                .replace(/@sampledate/g, detail.sampledate == null ? "" : detail.sampledate)
                .replace(/@sampleno/g, detail.sampleno == null ? "" : detail.sampleno)
                .replace(/@barcode/g, detail.barcode == null ? "" : detail.barcode)
                .replace(/@rptunitid/g, detail.rptunitid == null ? "" : detail.rptunitname + "(" + detail.rptunitid + ")")
                .replace(/@pat_name/g, detail.pat_name == null ? "" : detail.pat_name)
                .replace(/@pat_no/g, detail.pat_no == null ? "" : detail.pat_no)
                .replace(/@pat_idcardno/g, detail.pat_idcardno == null ? "" : detail.pat_idcardno)
                .replace(/@req_reason/g, detail.req_reason == null ? "" : detail.req_reason)
                .replace(/@hospcode/g, detail.hospcode == null ? "" : detail.hospcode);
            var reg = new RegExp('[/:*?"<>|	]', "g");
            newna = newna.replace(reg, "");
            this.nalist.push(newna);
            newna = this.$pub.Renaming(this.nalist, newna);
            return newna;
        },
        //递归调用打印 返回日志
        PDFBatchExport(that, data, exportFileTitle, prgno, env, index, folderna) {
            if (index < data.length) {
                this.exportIndex++;
                let item = data[index];
                // this.$nextTick(()=>{
                this.logList[this.logList.length - 1] = "正在生成 :" + "(" + (index + 1) + "/" + data.length + ")" + item.pdfna;
                // })
                this.$forceUpdate();
                return new Promise((s, f) => {
                    this.$tool
                        .request({
                            url: "ucent/print",
                            method: "post",
                            data: {
                                action: "rptPDFTrans",
                                reportid: item.reportid,
                                pdfna: item.pdfna,
                                folderna: folderna,
                                exportFileTitle: exportFileTitle,
                                env: env,
                            },
                        })
                        .then((res) => {
                            if (res.flag == "0") {
                                that.$alert(res.msg);
                            } else if (res.flag == "1") {
                                folderna = res.folderna;
                                this.PDFBatchExport(this, data, this.exportFileTitle, "LIS410_batch", "1", index + 1, folderna);
                            }
                            s();
                        })
                        .catch((e) => {
                            that.$alert("报告导出PDF出错:获取报告单失败。", "错误", {
                                confirmButtonText: "确定",
                            });
                            f();
                        });
                });
            } else {
                //全部导出
                this.logList.push("后台数据生成结束!");
                if (this.sel_mergePdf == 1) {
                    this.mergePdfs(that, data, folderna, "LIS410_merge");
                } else {
                    this.rptZip(folderna, "LIS410_batch");
                }
            }
        },
        //合并生成的PDF
        
        mergePdfs(that, exportdata, folderna, prgno) {
            this.logList.push("正在合并PDF文件!");
            return new Promise((s, f) => {
                this.$tool
                    .request({
                        url: "ucent/print",
                        method: "post",
                        data: {
                            action: "mergePdfs",
                            folderna: folderna,
                            exportdata: exportdata,
                        },
                    })
                    .then((res) => {
                        if (res.flag == "0") {
                            that.$alert(res.msg);
                        } else if (res.flag == "1") {
                            this.logList.push(res.msg);
                            this.logList.push("正在下载文件。");
                            let p = {
                                prgno: prgno,
                                filename: res.mergeFileName + ".pdf",
                                mergeFilePath: res.mergeFilePath,
                            };
                            this.batchExport(this, p, res.mergeFileName + ".pdf");
                            s();
                            //this.rptZip(folderna, prgno);
                        }
                    })
                    .catch((e) => {
                        that.$alert("报告导出PDF出错:合并PDF失败。", "错误", {
                            confirmButtonText: "确定",
                        });
                    });
            });
        },
        //压缩文件夹
        rptZip(folderna, prgno) {
            return new Promise((s, f) => {
                this.$tool
                    .request({
                        url: "ucent/print",
                        method: "post",
                        data: {
                            action: "rptZip",
                            folderna: folderna,
                        },
                    })
                    .then((res) => {
                        this.logList.push(res.msg);
                        this.logList.push("正在下载文件。");
                        let p = {
                            prgno: prgno,
                            filename: folderna,
                            zipPath: res.zipPath,
                            filesPath: res.filesPath,
                        };
                        this.batchExport(this, p, folderna + ".zip");
                        s();
                    })
                    .catch((e) => {
                        this.$alert(e, "错误", {
                            confirmButtonText: "确定",
                        });
                        f();
                    });
            });
        },
        //下载ZIP到客户端
        batchExport(that, p, filename) {
            return new Promise((s, f) => {
                this.$tool
                    .request({
                        url: "/ucent/downloadfile",
                        method: "post",
                        responseType: "blob",
                        data: {
                            ...p,
                        },
                    })
                    .then((res) => {
                        if (res.hasOwnProperty("errcode")) {
                            let msg = res.errmsg;
                            if (!msg) {
                                msg = "导出数据失败！";
                            } else {
                                msg = "导出数据失败   " + msg;
                            }
                            that.$alert(msg).then(() => {
                                f();
                                return false;
                            });
                        } else {
                            if (res) {
                                console.log("res.size===" + res.size);
                                if (res.size > 0) {
                                    let blob = new Blob([res], {
                                        type: "application/octet-stream",
                                    });
                                    let reader = new FileReader();
                                    reader.readAsDataURL(blob);
                                    reader.onload = (e) => {
                                        let objectUrl = window.URL.createObjectURL(blob);
                                        let a = document.createElement("a");
                                        a.download = filename;
                                        a.href = objectUrl;
                                        a.click();
                                        a.remove();
                                        window.URL.revokeObjectURL(objectUrl);
                                        this.logList.push("清除服务器临时文件,下载成功。");
                                    };
                                } else {
                                    that.$alert("导出数据为空！", "提示");
                                }
                            }
                            s();
                        }
                    });
            });
        },
        BtnClear(ctype) {
            this.rpttype = "1";
            this.image = "";
            this.show_sel = true;
            this.report_Loading = false;
            this.report_data = [];
            this.result_data = [];
            this.resusltmed_date = [];
            this.quicklyQ = "";
            this.tab_showflag = "tab_report";
            this.sel_rptunit = "";
            this.sel_rptunitlist = "";
            this.sel_patno = "";
            this.sel_patcardno = "";
            this.sel_reqbedno = "";
            this.sel_reportcomm = "";
            this.sel_reqreason = "";
            this.sel_result4 = "";
            if (ctype != 3) {
                this.sample_startdt = this.$pub.InitDateTime2(this.howdays - 1).datefrom;
                this.sample_enddt = this.$pub.InitDateTime2(0).dateto;
            }
            // this.sel_date = [XE.toDateString(XE.getWhatDay(new Date(), -7), "yyyy-MM-dd"), XE.toDateString(new Date(), "yyyy-MM-dd")];
            this.sel_patname = "";
            this.sel_patname_mh = "0";
            this.sel_pattypecode = "";
            this.sel_specimencode = "";
            this.sel_sampleno = "";
            this.sel_emerflag = "all";
            this.sel_reqdeptno = "";
            this.sel_chargetypeno = "";
            this.sel_chkflag = "all";
            this.sel_mixrpt = "0";
            this.sel_rflag = "all";
            this.sel_rptitemcode = "";
            this.sel_resultnum1 = "";
            this.sel_resultnum2 = "";
            this.sel_barcode = "";
            this.sel_reqdocno = "";
            this.sel_specimencomm = "all";
            this.sel_sampleduser = "";
            this.sel_patdiag = "";
            this.sel_reportuser = "";
            this.sel_reqwardno = "";
            this.sel_itemcombid = "";
            this.sel_allprint = false;
            this.sel_isprint = "all";
            this.sel_ischeck = "all";
            this.sel_pat_idcardno = "";
            this.sel_rechkuser = "";
            this.sel_combno = "";
            this.sel_outsex = false;
            this.sel_mh_patno = false;
            this.sel_onlymed = false;
            this.sel_markno = false;
            this.sel_txtinfo1 = "";
            this.sel_txtinfo2 = "";
            this.sel_hospitalcode = "";
            this.sel_pat_hospcode = "";
            this.sel_onlyouthospital = false;
            this.show_right = true;
            this.printReportid = "";
            this.rechkflag = "";
            this.unprint_flag = "";
            this.exportna = "";
            this.Qna = "快捷查询";
            this.currholder = "病人号,病人ID,卡号,姓名,条码号,报告ID,身份证";
            // this.$refs.refQuicklyQ.focus();
            if (ctype == 2) {
                //清除高级查询组件搜索条件
                this.$refs.rm_AdvancedSearch.cleaSerchData();
            }
            this.sTags = [];
            this.showTags = [];
        },
        reportcommchange(c, v) {
            this.sel_reportcomm = v;
            this.reportcommDlg = false;
        },
        //校验参考值
        BtnCheckRef() {
            //不存在数据时，弹窗提示。
            if (this.report_data == null || this.report_data.length == 0) {
                this.$alert("请先搜索出报告单数据再校验参考值。", "提示", {
                    confirmButtonText: "确定",
                });
                return false;
            } else {
                //存在数据
                this.dialogCheckRefVisible = true;
                this.msglist = []; //获取失败信息列表
                this.checkflag = 1;
                this.check_num = 0;
                if (this.rpt_amount > 5000) {
                    this.check_amount = 5000;
                } else this.check_amount = this.rpt_amount;
                this.CheckRef(0);
            }
        },
        //递归查询参考值
        CheckRef(index) {
            if (index < this.report_data.length && this.checkflag == 1) {
                let item = this.report_data[index];
                this.check_num = index + 1;
                // this.$forceUpdate();
                this.$tool
                    .request({
                        url: "LIS/LIS4/LIS410",
                        method: "post",
                        data: {
                            action: "checkrefs",
                            reportid: item.reportid,
                        },
                    })
                    .then((res) => {
                        if (res.err == 1) {
                            for (let i = 0; i < res.list.length; i++) {
                                //筛选出，报告单元ID、检验项目、标本类型、性别相同的首行数据
                                var flag = true;
                                for (var j = this.checkRefData.length - 1; j >= 0; j--) {
                                    //报告单元,报告项目，样本类型，性别，年龄，科室，诊断，生理周期，参考值差异
                                    if (res.list[i].rptunitname == this.checkRefData[j].rptunitname && res.list[i].rpt_itemname == this.checkRefData[j].rpt_itemname && res.list[i].specimen_name == this.checkRefData[j].specimen_name && res.list[i].pat_sex == this.checkRefData[j].pat_sex && res.list[i].pat_agestr == this.checkRefData[j].pat_agestr && res.list[i].diffstr == this.checkRefData[j].diffstr && res.list[i].req_deptname == this.checkRefData[j].req_deptname && res.list[i].pat_diag_icd == this.checkRefData[j].pat_diag_icd && res.list[i].physicycle == this.checkRefData[j].physicycle) {
                                        flag = false;
                                        break;
                                    }
                                }
                                if (flag) {
                                    this.checkRefData.push(res.list[i]); //添加
                                }
                            }
                        }
                        this.CheckRef(index + 1);
                    })
                    .catch((e) => {
                        this.$message.error(e);
                    });
            } else {
                this.checkflag = 1;
            }
        },
        recordexport() {
            this.$refs.refxTable.exportCsv({ filename: "校验参考值" });
        },
        cellClickEvent({ row, column }) {},
        //"rm-cancel"; //作废
        //"rm-disable"; //禁用
        //"rm-readonly"; //只读
        //"rm-alert"; //警告
        reportRowName({ row, rowIndex }) {
            if (row.rechk_dt != "" && row.rechk_dt != " " && row.rechk_dt != null) {
                if (XE.toNumber(row.print_count) > 0) {
                    return "rm-gray"; //审核过打印的
                } else {
                    return "colrow"; //没打印的
                }
            }
        },
        reportCellName({ row, rowIndex, column, columnIndex }) {
            if (column.property == "alter_flag") {
                if (row.alter_flag == "1" || row.alter_flag == "2") {
                    return "colred";
                }
            } else if (column.property == "redo_flag") {
                if (row.redo_flag == "2" || row.redo_flag == "3") {
                    return "colgreen";
                }
            } else if (column.property == "pat_name" || column.property == "pat_no") {
                //添加链接查询颜色
                return "col-blue";
            } else if (column.property == "unprint_reason") {
                return "col-red";
            }

            // if (column.property == "emer_flag") {
            //     if (row.emer_flag != "0") {
            //         return "rm_cell_green";
            //     }
            // }
        },
        // 通用行合并函数（将相同多列数据合并为一行）
        rowspanMethod({ row, $rowIndex, column, data }) {
            let fields = ["labgroupname", "rptunitname", "rpt_itemname", "specimen_name"];
            let cellValue = row[column.property];
            if (cellValue && fields.includes(column.property)) {
                let prevRow = data[$rowIndex - 1];
                let nextRow = data[$rowIndex + 1];
                if (prevRow && prevRow[column.property] === cellValue) {
                    return { rowspan: 0, colspan: 0 };
                } else {
                    let countRowspan = 1;
                    while (nextRow && nextRow[column.property] === cellValue) {
                        nextRow = data[++countRowspan + $rowIndex];
                    }
                    if (countRowspan > 1) {
                        return { rowspan: countRowspan, colspan: 1 };
                    }
                }
            }
        },
        //打印
        //合并打印按钮 有勾选默认打印勾选 无勾选打印选中行报告
        //列头点击时，按照当前列表顺序打印
        BtnPrint() {
            let printData = this.$refs.reportTable.afterFullData.filter((item) => {
                return item.cp_selection == "1";
            });
            console.log("🤣  printData:", printData);
            if (!(printData.length > 0)) {
                this.BtnCurrentPrint();
            } else {
                if (printData.length > 0) {
                    this.BtnBatchPrint();
                }
            }
        },
        // 恢复选中行打印
        BtnCurrentPrint() {
            if (this.printReportid == "") {
                this.$message("请先选择一份报告进行打印!");
                return false;
            } else if (this.rechkflag != "9") {
                this.$message("当前报告未审核，不可打印!");
                return false;
            } else if (this.unprint_flag == "8") {
                this.$message("当前报告需要授权打印!");
                return false;
            } else if (this.printReportid != "" && this.rechkflag == "9" && this.unprint_flag != "8") {
                this.printmsg = "正在打印，共1份报告";
                this.dialogVisible = true;
                this.$pub.printreport(this, this.printReportid, "1", "", "1", "1");
                setTimeout(() => {
                    this.dialogVisible = false;
                }, 2000);
            }
        },
        // 添加勾选打印
        BtnBatchPrint() {
            //打印
            let printData = this.report_data.filter((item) => {
                return item.cp_selection == "1";
            });
            let len = printData.length;
            if (len > 0) {
                let name = [];
                printData.forEach((item) => {
                    //遍历是否有不一样的的姓名的患者打印报告，有则提醒
                    if (name.indexOf(item.pat_name) > -1) {
                        //throw Error();
                    } else {
                        name.push(item.pat_name);
                    }
                });
                if (name.length > 1) {
                    //有至少两个人的报告
                    this.$confirm("当前选中多个病人的报告单，你确定要打印吗？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            this.PrintReport(len);
                        })
                        .catch((e) => {});
                } else {
                    //只有一个人的报告
                    this.PrintReport(len);
                }
            }
        },
        // 发送打印指令
        //打印顺序按照列头排序顺序
        PrintReport(len) {
            this.printmsg = "正在打印，共" + len + "份报告";
            this.dialogVisible = true;
            this.forbidList = [];
            let printData = this.$refs.reportTable.afterFullData.filter((item) => {
                return item.cp_selection == "1";
            });
            if (printData.length > 0) {
                this.printchk(printData, 0);
            }
        },
        //循环校验是否可打印、打印、返回日志
        printchk(data, index) {
            if (index < data.length) {
                let item = data[index];
                var reportid = data[index].reportid;
                // return new Promise((s, f) => {
                this.$tool
                    .request({
                        url: "LIS/LIS4/LIS410",
                        method: "post",
                        data: {
                            action: "chkrechk",
                            reportid: reportid,
                        },
                    })
                    .then((res) => {
                        if (res) {
                            if (res.ecode == 0) {
                                this.$pub.printreport(this, reportid, "1", "", "1").then(() => {
                                    let k = Number(data[index].print_count);
                                    data[index].print_count = k + 1;
                                });
                            } else if (res.ecode == -1) {
                                this.forbidList.push(res.erromsg);
                                this.dialogVisible = false;
                                this.dialogPrintchk = true;
                            }
                            this.printchk(data, index + 1);
                        }
                        //     s();
                        // })
                        // .catch((e) => {
                        //     this.dialogVisible = false;
                        //     this.$message.warning(e);
                        //     f();
                        // });
                    })
                    .catch((e) => {
                        console.log("e", e);
                        this.dialogVisible = false;
                    });
            } else {
                //全部导出
                this.dialogVisible = false;
                if (this.forbidList.length > 0) {
                    this.forbidList.push("打印结束，本次打印成功" + (data.length - this.forbidList.length) + "份报告,打印失败" + this.forbidList.length + "份报告。");
                }
            }
        },

        reqDblClickEvent({ row, column }) {
            if (column.property == "pat_idcardno" && row.pat_idcardnoen && row.pat_idcardnoen.length > 0) {
                this.Dec(row.pat_idcardnoen, "身份证/护照号");
            } else if (column.property == "pat_phone" && row.pat_phoneen && row.pat_phoneen.length > 0) {
                this.Dec(row.pat_phoneen, "电话");
            }
        },
        //双击链接查询
        cellDblClickEvent({ row, column }) {
            if (column.property == "pat_no") {
                this.sel_patno = row.pat_no;
                //给高级查询的病人号组件赋值
                this.$refs.rm_AdvancedSearch.setSerchData("sel_patno", row.pat_no);
                this.BtnQuery(0);
            } else if (column.property == "pat_name") {
                this.sel_patname = row.pat_name;
                //给高级查询的病人姓名组件赋值
                this.$refs.rm_AdvancedSearch.setSerchData("sel_patname", row.pat_name);
                this.BtnQuery(0);
            } else if (column.property == "sampleno") {
                if (this.PushToFlag) {
                    this.$confirm("是否直接跳转到报告处理中查看？", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            this.PushToUnit(row);
                            this.PushToFlag = false;
                        })
                        .catch(() => {});
                } else this.PushToUnit(row);
            } else if (column.property == "pat_idcardno" && row.pat_idcardnoen && row.pat_idcardnoen.length > 0) {
                this.Dec(row.pat_idcardnoen, "身份证/护照号");
            } else if (column.property == "pat_phone" && row.pat_phoneen && row.pat_phoneen.length > 0) {
                this.Dec(row.pat_phoneen, "电话");
            }
        },
        async Dec(ciphertext, name) {
            try {
                const res = await this.$tool.request({
                    url: "ucent/ddl",
                    method: "post",
                    data: {
                        action: "sm4decrypt",
                        ciphertext: ciphertext,
                    },
                });
                if (res) {
                    this.$alert(res, name, {
                        confirmButtonText: "确定",
                    });
                }
            } catch (e) {
                this.$message.warning(e);
            }
        },
        PushToUnit(row) {
            var pageinfo = this.$tool.getSession("RptPageInfo");
            var pagearr = JSON.parse(pageinfo);
            var multi = this.$tool.getLocalConfig("lis310multiple");
            row.AddBy410 = "1";
            this.$tool.setSession("RptTo", JSON.stringify(row));
            if (pagearr == null) pagearr = [];
            var prgno = "/LIS310";
            var unitinfo = this.rptunitAll[row.rptunitid];
            if (unitinfo) {
                switch (unitinfo.reporttype) {
                    case "10":
                        prgno = "/LIS310";
                        break;
                    case "20":
                        prgno = "/LIS311";
                        break;
                    case "50":
                        prgno = "/LIS312";
                        break;
                    case "40":
                        prgno = "/LIS313";
                        break;
                    case "60":
                        prgno = "/LIS314";
                        break;
                }
            }
            if (multi == "1") {
                //多开
                if (pagearr && pagearr.length == 0) {
                    pagearr.push({ id: 1, rptunitid: row.rptunitid, path: prgno + "?id=1", multi: "" });
                    this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
                    this.$router.push({ path: prgno + "?id=1" });
                } else {
                    var findone = pagearr.find((item) => item.rptunitid == row.rptunitid);
                    //如果找到了该报告单元已打开，直接把他移动到最后,这样激活报告处理时直接取最后一个就行
                    if (findone) {
                        var idx = pagearr.indexOf(findone);
                        if (idx !== -1) {
                            var item = pagearr.splice(idx, 1)[0];
                            item.exci = "1";
                            pagearr.push(item);
                        }
                        this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
                        this.$router.push({ path: findone.path });
                    } else {
                        var id = pagearr[pagearr.length - 1].id - 0 + 1;
                        pagearr.push({ id: id, rptunitid: row.rptunitid, path: prgno + "?id=" + id, multi: "" });
                        this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
                        this.$router.push({ path: prgno + "?id=" + id });
                    }
                }
            } else {
                //单开
                if (pagearr && pagearr.length == 0) {
                    pagearr.push({ id: 0, rptunitid: row.rptunitid, path: prgno, multi: "" });
                    this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
                    this.$router.push({ path: prgno });
                } else {
                    //已经打开页面
                    pagearr = [];
                    pagearr.push({ id: 0, rptunitid: row.rptunitid, path: prgno, multi: "", exci: "1" });
                    this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
                    this.$router.push({ path: prgno });
                }
            }
        },
        //全选/取消
        ChkAll(e) {
            if (this.report_data != null && this.report_data.length > 0) {
                this.report_data.forEach((item) => {
                    if (item.rechkflag == 9 && item.unprint_flag != 8) {
                        item.cp_selection = this.selectall == true ? "1" : "0";
                    }
                });
            }
        },
        // 勾选点击提示
        handleCheckedPrintChange(row, rowIndex) {
            //控制单选状态
            if (row.cp_selection != "0") {
                if (row.notserviceprint == "1") {
                    this.$alert("当前报告不可在服务台打印！", "提示", {
                        confirmButtonText: "确定",
                        callback: (action) => {
                            this.$nextTick(() => {
                                row.cp_selection = "0";
                            });
                        },
                    });
                }
                if (row.rechkflag != 9) {
                    //9已审核
                    this.$alert("当前报告未审核，不可打印！", "提示", {
                        confirmButtonText: "确定",
                        callback: (action) => {
                            this.$nextTick(() => {
                                row.cp_selection = "0";
                            });
                        },
                    });
                }
                if (row.unprint_flag == 8) {
                    this.$alert("当前报告需要单独授权才能打印，请到指定地点或用户处打印！", "提示", {
                        confirmButtonText: "确定",
                        callback: (action) => {
                            this.$nextTick(() => {
                                row.cp_selection = "0";
                            });
                        },
                    });
                }
                if (row.prereport == "1") {
                    this.$alert("当前报告为初步报告，只可查询，不可打印！", "提示", {
                        confirmButtonText: "确定",
                        callback: (action) => {
                            this.$nextTick(() => {
                                row.cp_selection = "0";
                            });
                        },
                    });
                }
            }
        },
        //预览选中的pdf
        BtnPreViewRpt({ row }) {
            var filepath = row.filepath;
            if (filepath.length > 0) {
                filepath = filepath.replace(".pdf", "");
            }
            this.$pub.historyreport(this, filepath);
        },
        //预览
        //支持多份报告同时预览
        BtnPreView() {
            let viewData = this.$refs.reportTable.afterFullData.filter((item) => {
                return item.cp_selection == "1" && item.rechkflag == "9" && item.unprint_flag != "8";
            });
            let len = viewData.length;
            if (len > 0) {
                let name = [];
                let reportidlist = "";
                viewData.forEach((item) => {
                    reportidlist += item.reportid + ",";
                    //遍历是否有不一样的的姓名的患者预览报告，有则提醒
                    if (name.indexOf(item.pat_name) > -1) {
                        //throw Error();
                    } else {
                        name.push(item.pat_name);
                    }
                });
                if (reportidlist != "") reportidlist = reportidlist.substring(0, reportidlist.length - 1);
                if (name.length > 1) {
                    //有至少两个人的报告
                    this.$confirm("当前选中多个病人的报告单，你确定要预览吗？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            this.$pub.printreport(this, reportidlist, "2", "", "1", "1");
                        })
                        .catch((e) => {});
                } else {
                    //只有一个人的报告
                    this.$pub.printreport(this, reportidlist, "2", "", "1", "1");
                }
            } else {
                if (this.printReportid == "") {
                    this.$message("请先选择一份报告进行预览!");
                    return false;
                } else if (this.rechkflag != "9") {
                    this.$message("当前报告未审核，不允许预览!");
                    return false;
                } else if (this.unprint_flag == "8") {
                    this.$message("当前报告需要单独授权才能预览");
                    return false;
                } else if (this.printReportid != "" && this.rechkflag == "9" && this.unprint_flag != "8") {
                    this.$pub.printreport(this, this.printReportid, "2", "", "1", "1");
                }
            }
        },
        //自助打印测试
        BtnAutoPrint() {
            if (this.printReportid == "") {
                this.$message("请先选择一份报告进行自助打印测试!");
                return false;
            } else if (this.rechkflag != "9") {
                this.$message("当前报告未审核，不可自助打印测试!");
                return false;
            } else if (this.unprint_flag == "8") {
                this.$message("当前报告需要单独授权，不可自助打印测试!");
                return false;
            } else if (this.printReportid != "" && this.rechkflag == "9") {
                this.$pub.printreport(this, this.printReportid, "1", "", "2", "1");
            }
        },
        Focus(event) {
            event.currentTarget.select();
        },
        RowClassName({ row }) {
            return this.$pub.getreqstatclass(row.req_stat);
        },
    },
};
</script>

<style scoped>
::v-deep .el-checkbox__inner::after {
    border: 2px solid #000000 !important;
    box-sizing: content-box;
    content: "";
    border-left: 0 !important;
    border-top: 0 !important;
    height: 7px;
    left: 4px;
    position: absolute;
    top: 1px;
    transform: rotate(45deg) scaleY(0);
    width: 3px;
    transition: transform 0.15s ease-in 0.05s;
    transform-origin: center;
}

::v-deep .el-checkbox__input.is-disabled + span.el-checkbox__label {
    color: #000000;
    cursor: not-allowed;
}

::v-deep .el-checkbox__label {
    display: inline-block;
    padding-left: 5px;
}

::v-deep .el-checkbox__input.is-disabled .el-checkbox__inner,
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner + .el-input.is-disabled .el-input__inner {
    background-color: #ffffff !important;
}

::v-deep .el-input--suffix .el-input__inner {
    padding-right: 5px;
}

.middle-tab-bottom {
    position: absolute;
    top: 0px;
    width: 100%;
    bottom: 0px;
    overflow: auto;
}

.pagetop {
    left: 0;
    right: 0;
    height: 305px;
    /* display: -webkit-box; */
    /* -webkit-box-pack: center; */
    /* -webkit-box-align: center; */
    border: solid 1px #ccc;
    position: absolute;
    z-index: 99;
    /* overflow-x: auto; */
    white-space: nowrap;
}

.pagecenter {
    position: absolute;
    top: 125px;
    width: 100%;
    left: 0;
    bottom: 0px;
    overflow: auto;
}

.pagebottom {
    position: absolute;
    width: 100%;
    left: 0;
    margin-top: 4px;
    height: 36px;
    bottom: 0px;
    -webkit-box-pack: center;
    -webkit-box-align: center;
    border: solid 1px #ccc;
}

.right-inser {
    position: absolute;
    top: 0;
    bottom: 0px;
    overflow: auto;
    width: 100%;
    right: 0px;
}

table tr td:nth-child(odd) {
    text-align: right;
    white-space: nowrap;
}

table tr td:nth-child(even) {
    text-align: left;
}

table tr td:nth-child(1) {
    width: 80px;
}

table {
    font-size: 12px;
    border-collapse: separate;
    border-spacing: 5px;
}

.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.avatar-uploader .el-upload:hover {
    border-color: #409eff;
}

.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
}

.avatar {
    width: 178px;
    height: 178px;
    display: block;
}

.avatar-uploader-icon1 {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 50px;
    line-height: 50px;
    text-align: center;
}

.avatar1 {
    width: 178px;
    height: 50px;
    display: block;
}

.middle-tab-top {
    position: absolute;
    top: 0px;
    width: 100%;
    height: 200px;
}

.middle-bottom {
    position: absolute;
    top: 37px;
    width: 100%;
    bottom: 0px;
    overflow: auto;
}

.middle-tab-bottom {
    position: absolute;
    top: 203px;
    width: 100%;
    bottom: 0px;
    overflow: auto;
}

.poppagetop {
    width: 100%;
    height: 24px;
    -webkit-box-pack: left;
    -webkit-box-align: center;
    position: absolute;
    /* border: 1px solid #ccc; */
    z-index: 999;
}

.poppagecenter {
    position: absolute;
    overflow: auto;
    top: 27px;
    width: 100%;
    height: 450px;
    left: 0;
}

::v-deep .el-select-dropdown__wrap {
    max-width: 400px;
}

::v-deep .vxe-table .vxe-body--row.row--hover td {
    background-color: #d7f1fd;
    vertical-align: top !important;
}

::v-deep .vxe-table.size--mini .vxe-body--column,
.vxe-table.size--mini .vxe-footer--column,
.vxe-table.size--mini .vxe-header--column {
    padding: 1px 0;
    vertical-align: top !important;
}

::v-deep .vxe-table .vxe-sort-wrapper {
    padding: 0 0px;
}

::v-deep .colred {
    background-color: red !important;
}

::v-deep .colgreen {
    background-color: #00ff00 !important;
}

::v-deep .colrow {
    background-color: #c0ffc0;
}

::v-deep .el-input.is-disabled .el-input__inner {
    color: #606266;
    cursor: default;
}

::v-deep .vxe-table .vxe-body--column.col-blue {
    color: blue;
}

::v-deep .vxe-table .vxe-body--column.col-red {
    color: red;
}
.fixtotal{
    overflow: hidden;
    position: absolute;
    left: 0px;
    bottom: 3%;
    z-index: 1;
    width: 100%;
}
</style>